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 import of CSV file: hard-coded value for field??

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-05-20 : 09:13:04
Eric Tennett writes "I have a table with col1, col2, col3. col1 & col2 will be will be imported from a csv file using DTS. But I want to hardcode col3 to be "1". All three columns comprise the primary key. Can this be done without using a staging table? Can a format file be used for this?"

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-05-20 : 19:04:54
Yes, you can do it.

In the 'Transformations' tab when you specify your column mappings, you're probably using a Copy Column task to transfer the data. Remove this and replace it with ActiveX Script. Then you can control it. Your code might look something like:

Function Main()
DTSDestination("col1") = DTSSource("Col001")
DTSDestination("col2") = DTSSource("Col002")
DTSDestination("col3") = "1"
Main = DTSTransformStat_OK
End Function
Go to Top of Page

byrmol
Shed Building SQL Farmer

1591 Posts

Posted - 2004-05-20 : 20:56:36
Create a view and insert into that....

DavidM

"Always pre-heat the oven"
Go to Top of Page
   

- Advertisement -