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 Administration (2000)
 Bulk insert

Author  Topic 

imughal
Posting Yak Master

192 Posts

Posted - 2004-10-04 : 06:43:52
i m working to insert bulk record from csv file i m trying following code but getting error.

bulk insert orders
from 'c:\orders.csv'
WITH
( FIELDTERMINATOR = ',', ROWTERMINATOR = '\n'
)

tell me how to do bulkminsert from csv file.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-10-04 : 13:39:50
What error are you getting?

Tara
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-10-04 : 14:00:30
Depends what format the file is
Things to look for:
Row terminator being one of crlf instead of both.
Embedded ',' withing fields messing things up - nothing you can do about that unless
Quote delimmitted character fields.
Extra blank lines at the end of the file.

Try it with a couple of lines from the file first to see if the structure is close
see
http://www.nigelrivett.net/BCP_quoted_CSV_Format_file.html

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -