All,
Version - SQL Server 2008 R2 ,SP1
Trying to do a bulk insert but getting the below error
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 4, column 8
Below is the command for bulk insert
bulk insert aaa_user_session
from 'T:\AAA_USER_SESSION.txt'
with
( FIRSTROW = 3,
ROWTERMINATOR = '\n',
FIELDTERMINATOR = ','
)
CREATE TABLE [dbo].[AAA_USER_SESSION](
[USR_SESS_TOK] [varchar](64) NULL,
[CLNT_REF_ID] [varchar](64) NULL,
[USR_SESS_EXPR_TIME] [datetime] NULL,
[ID] [varchar](50) NULL,
[USM_CREATOR] [varchar](50) NULL,
[USM_CREATE_TS] [datetime] NULL,
[USM_UPDATOR] [varchar](10) NULL,
[USM_UPDATE_TS] [datetime] NULL
)
Sample first 5 lines of the file
USR_SESS_TOK,CLNT_REF_ID,USR_SESS_EXPR_TIME,ID,USM_CREATOR,USM_CREATE_TS,USM_UPDATOR,USM_UPDATE_TS
------------,-----------,------------------,--,-----------,-------------,-----------,-------------
12349876,QA0909,2009-10-09 13:16:09.577,NULL,suresh,2009-10-09 12:34:59.320,NULL,2009-10-09 12:46:17.033
12349876,QA0909,2009-10-09 15:16:46.063,NULL,suresh,2009-10-09 13:46:58.353,NULL,NULL
12349876,QA0909,2009-10-09 15:18:44.110,NULL,suresh,2009-10-09 13:48:56.433,NULL,NULL
Is the last column usm_update_ts being null the issue? How do I insert the data?
I even tried bcp command but it gave me the below error but it inserted first row but gave an error on the 2nd and 3rd.
Error = [Microsoft][SQL Server Native Client 10.0]Invalid character value for cast specification
exec master..xp_cmdshell 'bcp AP_PP..AAA_USER_SESSION in "T:\AAA_USER_SESSION_TEST.txt" -S SCLPP01 -c -t, -T'
Thank you all in advance for your help.
Version - SQL Server 2008 R2 ,SP1
Trying to do a bulk insert but getting the below error
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 4, column 8
Below is the command for bulk insert
bulk insert aaa_user_session
from 'T:\AAA_USER_SESSION.txt'
with
( FIRSTROW = 3,
ROWTERMINATOR = '\n',
FIELDTERMINATOR = ','
)
CREATE TABLE [dbo].[AAA_USER_SESSION](
[USR_SESS_TOK] [varchar](64) NULL,
[CLNT_REF_ID] [varchar](64) NULL,
[USR_SESS_EXPR_TIME] [datetime] NULL,
[ID] [varchar](50) NULL,
[USM_CREATOR] [varchar](50) NULL,
[USM_CREATE_TS] [datetime] NULL,
[USM_UPDATOR] [varchar](10) NULL,
[USM_UPDATE_TS] [datetime] NULL
)
Sample first 5 lines of the file
USR_SESS_TOK,CLNT_REF_ID,USR_SESS_EXPR_TIME,ID,USM_CREATOR,USM_CREATE_TS,USM_UPDATOR,USM_UPDATE_TS
------------,-----------,------------------,--,-----------,-------------,-----------,-------------
12349876,QA0909,2009-10-09 13:16:09.577,NULL,suresh,2009-10-09 12:34:59.320,NULL,2009-10-09 12:46:17.033
12349876,QA0909,2009-10-09 15:16:46.063,NULL,suresh,2009-10-09 13:46:58.353,NULL,NULL
12349876,QA0909,2009-10-09 15:18:44.110,NULL,suresh,2009-10-09 13:48:56.433,NULL,NULL
Is the last column usm_update_ts being null the issue? How do I insert the data?
I even tried bcp command but it gave me the below error but it inserted first row but gave an error on the 2nd and 3rd.
Error = [Microsoft][SQL Server Native Client 10.0]Invalid character value for cast specification
exec master..xp_cmdshell 'bcp AP_PP..AAA_USER_SESSION in "T:\AAA_USER_SESSION_TEST.txt" -S SCLPP01 -c -t, -T'
Thank you all in advance for your help.