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
 SQL Server Development (2000)
 bulk insert

Author  Topic 

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2008-10-16 : 18:00:36
i have a text file that is tab delimited and it has 6 datafields.
I want to import that text file information to a sql server table but i need only the the first 4 data fields and exclude the last two fields while importing.

How can i do that using bulk insert.

thanks in advance

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-16 : 18:59:46
http://msdn.microsoft.com/en-us/library/ms179250.aspx
Go to Top of Page

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2008-10-17 : 10:59:02
My Back end is SQL server 2000 and the openrowset(bulk )
would not work.

What is the solution now?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-17 : 11:05:10
quote:
Originally posted by akpaga

My Back end is SQL server 2000 and the openrowset(bulk )
would not work.

What is the solution now?


use DTS export import task.and map only required columns from text file to your destination table.
Go to Top of Page

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2008-10-24 : 17:15:02
How can I do that with automation . I mean can i schedule a job to do that. One more thing there are no cloumn headers for the file.

Thanks for your response.
Go to Top of Page

hanbingl
Aged Yak Warrior

652 Posts

Posted - 2008-10-24 : 17:19:44
After create DTS package, you can drag a dynamic properties to your DTS which selects the input file base on INI file, global variable or database entries.

Now you can dynamically change your input file from the INI file. Right click on the DTS package to schedule it.
Go to Top of Page

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2008-10-24 : 18:26:58
Sorry I did not understand. I said there are no column headers to the file and the file is pipe delimited.
Go to Top of Page

hanbingl
Aged Yak Warrior

652 Posts

Posted - 2008-10-24 : 18:32:52
You can use DTS to map each column to the your table accordingly. DTS is a "setup once then forget it" tool, simple and manageable.
Go to Top of Page
   

- Advertisement -