Hello Everyone Iam trying to bulk insert data from .dat file(unloaded from sybase) in to the开发者_Go百科 table i created.
Here is the Table Definition:
CREATE TABLE dbo."GCK_KioskSetupOptions" (
"SMTPIPAddress" varchar(128) NULL
,"SMTPPort" varchar(20) NULL
,"POP3IPAddress" varchar(128) NULL
,"POP3Port" varchar(20) NULL
,"AutoLogOffDelay" integer NULL
,"AllowUserToPrint" bit NOT NULL
,"AllowAttachment" bit NOT NULL
,"MaxMessageSize" integer NULL
,"BillingCodeOptionID" integer NOT NULL
,"MaxMessage" integer NULL
,"AllowUserToImport" bit NOT NULL
,"ProtectUserWithPassword" varchar(50) NULL
,"DefaultEncoding" varchar(50) NULL
,"EnableMessageLimit" bit NULL
,"GlobalMessageLimit" integer NULL DEFAULT 30
,"AllowSetMessagePriority" bit NOT NULL DEFAULT 0
)
go
There is only a single row ( because of empty database) in .dat file which needs to be inserted into the table mentioned above
Here is .dat file data format
'127.0.0.1','25','127.0.0.1','110',10,1,1,400,2,250,1,
Here is the Bulk Inset command
BULK
INSERT GCK_KioskSetupOptions
FROM 'C:\Program Files\Globe Wireless\WebMail\Database\Defaults\Data\404.dat'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
GO
Running this command in SQLServer Management Studio iam getting these errors Msg 4832, Level 16, State 1, Line 2 Bulk load: An unexpected end of file was encountered in the data file. Msg 7399, Level 16, State 1, Line 2 The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error. Msg 7330, Level 16, State 2, Line 2 Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".
Could anyone help me out solving this issue?.I am actually doing datamigration from Sybase SQL Anywhere 11 to SQL server 2008 R2 express and this is the first issue i am facting when trying to import data from .dat file into SQL Server 2008 r2 EXPRESS table.
Thankyou
By the looks of things there are ll fields in the sample data file but 16 columns in your table.
I think you need to pad out the input with the defaults.
Instead of just
'127.0.0.1','25','127.0.0.1','110',10,1,1,400,2,250,1,
you need
'127.0.0.1','25','127.0.0.1','110',10,1,1,400,2,250,1,,,,,
精彩评论