Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 DTS tansform column names into rows

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-05-25 : 08:40:15
Steve writes "I have a table called PTT_ExternalData
(DataID INT Primary,
SourceID INT
ColumName NVARCHAR 255,
ColumnValue NVARCHAR 255)

I want to run a DTS that uses a txt file.
The first 4 lines of this txt including column names are:

"EstimateNumber","ProjectNum","ProjectName","Address","City","State","Zip",
"ProjectGrouping","DeliveryType","ProjectStatus","ProjectType","Treatment",
"CostGroup","BOMCatalog","ProjectManager","Contractor","SiteRelease","ReleasedToSurveyor",
"HasSurvey","SurveyCompleted","HasJobberMID","MID1IssueDate","MID1ApprovalStatus",
"MID2IssueDate","MID2ApprovalStatus","MID3IssueDate","MID3ApprovalStatus","HasBOM",
"BOMRevision","BOMRevisionDate","BOMApprovedStatus","BOMResponderDate",
"JobberBookComplete","EstCompleteMaterialsDelivered","ActCompleteMaterialsDelivered",
"EstStartConstruction","ActStartConstruction","ActCompleteConstruction","ProjectSignoff",
"ProjectCloseout","SitePutOnHold","SiteCancelled","TreatmentLevelChanged","HasPO",
"POCount","POTotal","HasSubcontract","SubcontractCount","SubcontractTotal",
"ApprovedBudget","TotalProjectSpend","OCOLaborTotal","OCOMaterialTotal","OCOTotal"
"","0005","Mark's Test Project #25","Amoco Station 10 Burbon Street","Somewhere","NJ","99999","","JO-Bob Coffey",
"Materials Only","ECBU-S -- Dothan","","","","","","No","","No","","","","",
"","","No",
"","","No",0,"No",0,0
"","440NewBuildEurope","New Build - Europe","New Build - Europe","","","",
"","","Released for Survey","","","","","","","No","","No","","","","","","","No","","","No",0,
"No",0,0
"","50100000","DCA-General","","","","","","","","","","","","","",
"No","","No","","","","","","","No","","","No",0,"No",0,0

I want to add a row in PTT_ExternalData for each item in this list with the SourceID to default to 1. So that means I need to strip out the Column Headings and somehow use them as Global Variables so that they match for each row, and loop through all rows.

This is causing me many headaches, please help.
Thanks"

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-05-25 : 21:43:30
Steve,

Check out this article:

http://www.winnetmag.com/Articles/ArticleID/7836/pg/2/2.html

With some mods, it looks like it would do what you want.

Tim
Go to Top of Page
   

- Advertisement -