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 - Never Done Before

Author  Topic 

jesus4u
Posting Yak Master

204 Posts

Posted - 2003-03-04 : 09:17:43
I have never used it and i looked at BOL and I have this so far.
But I keep getting the error from the query analyzer:

Incorrect syntax near the keyword 'from'.

Waz up?


BULK INSERT Traffic.dbo.BulkTable
FROM 'C:\Documents and Settings\apoko\Desktop\lstatslog\cor\Logs\rm\ex0302.log'
WITH
(
BATCHSIZE = 100,
FIELDTERMINATOR = '\t',
ROWTERMINATOR = '\n'
)



nr
SQLTeam MVY

12543 Posts

Posted - 2003-03-04 : 19:23:32
Are you sure it's from this statement?


==========================================
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

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2003-03-04 : 19:30:25
Syntax looks ok.

1. Make sure table, owner and db are correct and exist
2. Make sure log file exists on server machine otherwise must map drive and use unc path.
3. Run statement isolated (NR's concern)
4. post sql server version, script and log file for review by sqlteam members.





Edited by - ValterBorges on 03/04/2003 19:31:57
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-03-04 : 19:41:10
I also don't see a problem with your query. If you can't get it to work, just use bcp:

bcp Traffic.dbo.BulkTable in C:\Documents and Settings\apoko\Desktop\lstatslog\cor\Logs\rm\ex0302.log -b100 -t\t -r\n

Tara
Go to Top of Page

jesus4u
Posting Yak Master

204 Posts

Posted - 2003-03-05 : 08:14:07
I got it working! What was happening was that the fields weren't exactly matched from the file to the table.

How can the bulk insert deal with an EOF character at the end of a textfile because it errors at that point.


Go to Top of Page
   

- Advertisement -