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)
 Bulk insert ordering

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-07-06 : 07:41:56
Brian writes "We are Using BULK INSERT to import Standard 27 Files (Banking payments). these files contain header and footer records. We can import them ok (single field VARCHAR(120) table) but when we read the data back somtimes (1 in 4)the order of the data is different to the order in the ASCII file (The footer appears in the middle of the data Code =
DECLARE @Command VARCHAR(200)

Create Table #tmp120 (
txt VARCHAR(120)
)

SELECT @Command = 'BULK INSERT #tmp120 FROM ''\\kbs1\keybank2\import\KBSBankFl.Emt'''
EXEC (@Command)
select * from #tmp120"

SamC
White Water Yakist

3467 Posts

Posted - 2005-07-06 : 07:44:31
You'll need to create a row order since none is implied.

Maybe an IDENTITY column would do?

CREATE TABLE #tmp120 (
ROWID INT IDENTITY(1,1) NOT NULL UNIQUE,
txt VARCHAR(120)
)
Go to Top of Page
   

- Advertisement -