We help IT Professionals succeed at work.

dts export error "duplicate column name"

faclogistics
faclogistics asked
on
411 Views
Last Modified: 2008-02-01
hello- (i don't think this is too difficult, but i need a pretty quick answer if possible)

I am pretty new to SQL server.  I am trying to use a DTS package to export info from a query to a text file.  When I execute the DTS I get the following error:

Duplicate Column Name; add1

Well, I can't change the column names.  Is there a way around this?  Query is below in case you need it.

thanks...Crissy

SELECT
      vw_po_DE.pono,
      vw_po_DE.loadid,
      freightbillpo.stopno, freightbillpo.dropno, freightbillpo.routestopno, freightbillpo.routedropno, vw_loads_de.carriercode,
      vw_loads_de.carriername, vw_po_DE.vendorcode, vw_po_DE.vendorname, vw_shippoints_DE.facilityname, vw_shippoints_DE.add1, vw_shippoints_DE.city,
      vw_shippoints_DE.state, vw_shippoints_DE.zip, vw_consignees_DE.consigneecode, vw_consignees_DE.name, vw_consignees_DE.receivingwarehouse,
      vw_consignees_DE.add1, vw_consignees_DE.city, vw_consignees_DE.state, vw_consignees_DE.zip, vw_po_DE.schedpickuptime, vw_po_DE.schedarrivetime,
      vw_po_DE.releaseno,

    CASE [managedtypes].[thirdpartybilltotype] WHEN 'CON' THEN [vw_po_DE].[consigneecode] ELSE
        CASE [managedtypes].[thirdpartybilltotype] WHEN 'VEN' THEN [vw_po_DE].[vendorcode] ELSE
            CASE [managedtypes].[thirdpartybilltotype] WHEN 'OWN' THEN [vw_po_DE].[ownercode] ELSE '0'
            END
        END
    END AS BilleeCode,

    case [managedtypes].[thirdpartybilltotype] when 'CON' then [vw_po_DE].[consigneename] else
      case [managedtypes].[thirdpartybilltotype] when 'VEN' then [vw_po_DE].[vendorname] else
          case [managedtypes].[thirdpartybilltotype] when 'OWN' then [vw_owners_DE].[name] else '0'
            end
        end
    end AS BilleeName,

      vw_loads_de.hot, vw_po_DE.estcases, vw_po_DE.estweight, vw_po_DE.commoditycode, vw_loads_de.freightbillid, vw_po_DE.pallettype, vw_loads_de.dispatchtime

FROM (vw_consignees_DE AS vw_consignees_DE_1 INNER JOIN (((((vw_po_DE INNER JOIN managedtypes ON vw_po_DE.managedtype = managedtypes.typeid)
      INNER JOIN vw_consignees_DE ON vw_po_DE.consigneecode = vw_consignees_DE.consigneecode) INNER JOIN (freightbillpo
      INNER JOIN vw_loads_de ON (freightbillpo.freightbillid = vw_loads_de.freightbillid) AND (freightbillpo.poid = vw_loads_de.poid))
            ON vw_po_DE.loadid = vw_loads_de.loadid) INNER JOIN vw_shippoints_DE ON vw_po_DE.shippointid = vw_shippoints_DE.shippointid)
      INNER JOIN vw_vendors_DE ON vw_po_DE.vendorid = vw_vendors_DE.vendorid) ON vw_consignees_DE_1.consigneecode = vw_po_DE.destcode)
      INNER JOIN vw_owners_DE ON vw_po_DE.ownercode = vw_owners_DE.ownercode

WHERE vw_loads_de.dispatchtime Between '2/16/2006' And '2/16/2006 23:59:0' and (vw_po_de.actarrivetime is null)

order by vw_po_de.loadid
Comment
Watch Question

Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
you have to give an alias name to the duplicate field name, for example:

SELECT
     vw_po_DE.pono,
     vw_po_DE.loadid,
     freightbillpo.stopno, freightbillpo.dropno, freightbillpo.routestopno, freightbillpo.routedropno, vw_loads_de.carriercode,
     vw_loads_de.carriername, vw_po_DE.vendorcode, vw_po_DE.vendorname, vw_shippoints_DE.facilityname, vw_shippoints_DE.add1 as shippoints_add1, vw_shippoints_DE.city,
     vw_shippoints_DE.state, vw_shippoints_DE.zip, vw_consignees_DE.consigneecode, vw_consignees_DE.name, vw_consignees_DE.receivingwarehouse,
     vw_consignees_DE.add1 as consignees_add1, vw_consignees_DE.city, vw_consignees_DE.state, vw_consignees_DE.zip, vw_po_DE.schedpickuptime, vw_po_DE.schedarrivetime,
     vw_po_DE.releaseno,
  ...

Author

Commented:
Now I'm getting "invalid transformations detected. verify and retry your transformations."
Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
You are awesome!
Thank you...

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.