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 2005 Forums
 Transact-SQL (2005)
 Import text file and insert into a table

Author  Topic 

Sun Foster
Aged Yak Warrior

515 Posts

Posted - 2007-06-01 : 10:54:40
How to code a store procedure to do:
1) read a delimited text, delete line 1, line 2 and last line
2) insert into a table

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-01 : 10:56:14
2 http://www.nigelrivett.net/SQLTsql/ImportTextFiles.html


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Sun Foster
Aged Yak Warrior

515 Posts

Posted - 2007-06-01 : 13:50:36
I ran:

exec importFiles 'c:\Transfer\' , 'c:\Transfer\Archive\' , 'bcp*.txt', 'MergeBCPData'

but got error:

Cannot bulk load because the file "c:\Transfer\The system cannot find the file specified." could not be opened. Operating system error code 3(The system cannot find the path specified.).
Go to Top of Page

Sun Foster
Aged Yak Warrior

515 Posts

Posted - 2007-06-01 : 15:06:08
Many thanks to Tara Kizer.
Once I copied text files into server c drive, it works fine!
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-02 : 02:20:47
quote:
Originally posted by Sun Foster

Many thanks to Tara Kizer.
Once I copied text files into server c drive, it works fine!

Are you referring this thread?
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81184

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -