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 Import Stop SQL Service

Author  Topic 

jhocutt
Constraint Violating Yak Guru

385 Posts

Posted - 2005-09-15 : 11:06:28
Any idea why this would shut down the MSSQLSERVER service?

use Northwind
go

-- Import contains the following
-- 123,456
-- 123,456
-- 123,456
-- 123,456

create table #tmp (
c1 varchar(10),
c2 varchar(10)
)


BULK INSERT #tmp
FROM 'C:\Temp\Import.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '0x0a0x0d',
BATCHSIZE = 10000,
TABLOCK
)

drop table #tmp

The problem is in the ROWTERMINATOR = '0x0a0x0d' if I change it to
ROWTERMINATOR = '0x0a' it works, My question is more why would putting a CRLF crash the server when a CR does not.


"God does not play dice" -- Albert Einstein
"Not only does God play dice, but he sometimes throws them where they cannot be seen."
-- Stephen Hawking

nr
SQLTeam MVY

12543 Posts

Posted - 2005-09-17 : 18:51:22
Try it without the rowterminator i.e. leaving it to default.
Are you sure the file has a crlf as row terminator?

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

jhocutt
Constraint Violating Yak Guru

385 Posts

Posted - 2005-09-19 : 10:59:10
Running it without the rowterminator does work, and yes the file does have a CRLF at the end.
The
Getting the data to load was not the problem, my concern is why a bulk insert would cause the MSSQL service to do a restart. Failing to import I can understand, but a server crash seems a little extreme.


"God does not play dice" -- Albert Einstein
"Not only does God play dice, but he sometimes throws them where they cannot be seen."
-- Stephen Hawking
Go to Top of Page
   

- Advertisement -