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 - Text File Import

Author  Topic 

ramdas
Posting Yak Master

181 Posts

Posted - 2002-12-18 : 10:48:17
Hi Folks,
I have text files which need to be imported into a SQL Server Table. The Text Files have column names in the first row. How do I map the columns in the text file to the columns in the table. There are three columns in the text file that need to be to the columns in the table.
How would I do this.
Bye

Ramdas Narayanan
SQL Server DBA

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-12-18 : 11:22:01
You can create a DTS package (or even use the Import/Export wizard) and it will automatically map the columns in the text file to the ones in the table. You can tell it that the text file contains column names on the first row too, it will not import them. You can also change the mapping of the columns on the Transformations tab before you run the package.

If you can't or don't want to use DTS, BULK INSERT and bcp can use format files to map text file columns to table columns, and you can use arguments to skip the first row. Look up "BULK INSERT", "bcp" and "format files" in Books Online for more details.

Go to Top of Page
   

- Advertisement -