tsql - using bcp to copy between servers gives SQLState 22008 -
i'm trying copy data 1 database (on different servers) tables have identical schema, every time run below query error saying following...
"sqlstate = 22008 nativeerror = 0 error = [microsoft][sql server native client 10.0]invalid date format"
the query this...
exec sp_configure 'show advanced options', 1 go reconfigure go exec sp_configure 'xp_cmdshell', 1 go reconfigure go declare @masterservername varchar(40) declare @masterserverusername varchar(20) declare @masterserverpassword varchar(20) declare @slaveservername varchar(40) declare @slaveserverusername varchar(20) declare @slaveserverpassword varchar(20) declare @exportfile varchar (40) declare @exportfile1 varchar (40) declare @exportfile2 varchar (40) declare @exportfile3 varchar (40) declare @exportfile4 varchar (40) set @masterservername='{sql_server_name}' set @masterserverusername='{sql_user_login}' set @masterserverpassword='{sql_user_password}' set @slaveservername='{slave_name}\{slave_instance}' set @slaveserverusername='{slave_user_login}' set @slaveserverpassword='{slave_user_password}' ------------------------------------- set @exportfile1='c:\exporttracking1.txt' set @exportfile2='c:\exporttracking2.txt' set @exportfile3='c:\exporttracking3.txt' set @exportfile4='c:\exporttracking4.txt' declare @bcp varchar(8000) ---------------------------------------------- --collecting tracking data slave server ----------------------------------------------- set @bcp = 'bcp "select * <database_name>.dbo.<table_name> exportid="9999999"" queryoutout '+@exportfile1+' -c -u'+@slaveserverusername+' -p'+@slaveserverpassword+' -s'+@slaveservername+' -c{850}' print @bcp exec xp_cmdshell @bcp ----------------------------------------------- --adding tracking data master server ----------------------------------------------- set @bcp = 'bcp <database_name>.dbo.<table_name> in '+@exportfile1+' -e c:\error1.txt -c -u'+@masterserverusername+' -p'+@masterserverpassword+' -s'+@masterservername+' -c{850}' print @bcp exec xp_cmdshell @bcp ----------------------------------------------- exec sp_configure 'xp_cmdshell', 0 go reconfigure go exec sp_configure 'show advanced options', 0 go reconfigure go
can please shed light on why error occurring?
any input appreciated.
thanks
lee
less probable possible, please check language , regional settings of windows servers running sql instances.
Comments
Post a Comment