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
 SSIS and Import/Export (2005)
 Bul Insert

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2007-02-26 : 10:15:46
Pete writes "I have a text file formattted like this:

"1" "Joe Smith" "123 Main St." " "
"2" "Tom Jones" "123 Maple Drive" " "
etc.

When I use the commande below:

BULK INSERT test.dbo.[importtable]
FROM 'C:\test.txt'
WITH
(
FIELDTERMINATOR = '\t',
ROWTERMINATOR = '\r'
)


It imports the first record and the puts the entire contents of the second record into the last field of record 1. It looks like it doesn't hit the ROWTERMINATOR.

Am I doing something wrong?"

nr
SQLTeam MVY

12543 Posts

Posted - 2007-02-26 : 21:56:47
try 0x10 or 0x13 as the row terminator.
Also do you have the correct number of columns in the table for the file.
Try looking at it with a hex editor to see what the row terminator is.

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