February 5, 2014 at 4:40 am
Hello, I have table with columns of type int. I export this table by using bcp:
bcp dbo.int_table out file.dat -q -CRAW -T -S localhost -E .
Now I want to import it to table with columns of type bigint. I use bcp command:
bcp dbo.bigint_table in file.dat -q -CRAW -T -S localhost -E
I get error:
Error = [Microsoft][SQL Native Client]Numeric value out of range
SQLState = 22003, NativeError = 0
Error = [Microsoft][SQL Native Client]Numeric value out of range
SQLState = 22003, NativeError = 0
Error = [Microsoft][SQL Native Client]Numeric value out of range
SQLState = 22003, NativeError = 0
Error = [Microsoft][SQL Native Client]Numeric value out of range
SQLState = 22003, NativeError = 0
Error = [Microsoft][SQL Native Client]Numeric value out of range
SQLState = 22003, NativeError = 0
Error = [Microsoft][SQL Native Client]Numeric value out of range
SQLState = 22003, NativeError = 0
Error = [Microsoft][SQL Native Client]Numeric value out of range
SQLState = 22003, NativeError = 0
Error = [Microsoft][SQL Native Client]Numeric value out of range
SQLState = 22003, NativeError = 0
Error = [Microsoft][SQL Native Client]Numeric value out of range
SQLState = 22003, NativeError = 0
i was trying import table by using format file created based on bigint_table by command:
bcp dbo.bigint_table in file.dat -f format_file_bigint.xml -q -CRAW -T -S localhost -E
but i also gets the same errors.
Can I use format file when during export was used -CRAW option????
February 5, 2014 at 9:10 am
You don't want to use RAW in this case because it expects the data types to be the same. Use something other than RAW, or use a query out that casts (or converts) the ints to bigints and writes those to the file.
The probability of survival is inversely proportional to the angle of arrival.
February 6, 2014 at 1:46 am
The problem is that, that i can't modify bcp out command. I need to find solution to import int data from dat file created with -CRAW option to bigint table. Is this possible? Using format file will be helpful? If yes How use it?
February 6, 2014 at 7:29 am
Okay, then your only other option is to bcp in to a stage table that has ints, then do a final insert into the destination table having the bigints.
The probability of survival is inversely proportional to the angle of arrival.
February 6, 2014 at 8:09 am
Ok, thanks....I was hope that i can do this in other way - not inserting in int table and copying data from it to bigint.....
February 6, 2014 at 8:28 am
videl666 (2/6/2014)
Ok, thanks....I was hope that i can do this in other way - not inserting in int table and copying data from it to bigint.....
Well, I supposed you could alter the columns of the destination table to be ints before the BCP IN, then alter the columns afterwards to bigints.
The probability of survival is inversely proportional to the angle of arrival.
February 8, 2014 at 9:41 am
Hmm... I can't do that because in destination table i have other bigint data......
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply