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
 Import/Export (DTS) and Replication (2000)
 problem with bulk insert

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-02-25 : 08:56:43
Sudheer Kurup writes "I have a problem while using "Bulk insert" statement in sql server 2000

My text file contains data in this format
6000000,1000,2000,,abc0,def0,,,,,,,,,,,,,,,,,,,
6000001,1001,2001,,abc1,def1,,,,,,,,,,,,,,,,,,,
6000002,1002,2002,,abc2,def2,,,,,,,,,,,,,,,,,,,
6000003,1003,2003,,abc3,def3,,,,,,,,,,,,,,,,,,,
6000004,1004,2004,,abc4,def4,,,,,,,,,,,,,,,,,,,
6000005,1005,2005,,abc5,def5,,,,,,,,,,,,,,,,,,,
where "," is the field separator

Now the problem is when I use Bulk insert to insert data in to the table using this file, only the 1st , 3rd and 5th rows are inserted (i.e. alternate records) , whereas all the rows should be inserted.

Can you please help me to understand the problem as to why this occurs and what is the possible solution for this.

Eagerly awaiting for your prompt reply.

Thanks and Regards,
Sudheer"

nr
SQLTeam MVY

12543 Posts

Posted - 2002-02-25 : 09:43:06
Probably you have short rows - i.e. table has more fields that the file. bcp will use the next row to finish the entry and not give an error unless there is a type mismatch.

Always a good idea to check the number of rows inserted.

==========================================
Cursors are useful if you don't know sql.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -