I am getting a 'Invalid character value for cast specification' error when
trying to BCP data from a SQL 8.00.760 instance to a SQL 9.00.2047 instance.
BCP out syntax...
exec master..xp_cmdshell 'BCP database..table in D:\Temp\database\table.txt
-e D:\Temp\database\table.err -b 1000 -c -S server\instance -U sa -P password
-E'
BCP in syntax...
exec master..xp_cmdshell 'BCP database..table in D:\Temp\database\table.txt
-e D:\Temp\database\table.err -b 1000 -c -S server\instance -U sa -P password
-E'
BCP error...
SQLState = 22005, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Invalid character value for cast
specification
The data in the column it's giving the error on is: 0xFFFFFF7F
John Oberlin (JohnOberlin@.discussions.microsoft.com) writes:
> I am getting a 'Invalid character value for cast specification' error
> when trying to BCP data from a SQL 8.00.760 instance to a SQL 9.00.2047
> instance.
> BCP out syntax...
> exec master..xp_cmdshell 'BCP database..table in
> D:\Temp\database\table.txt
> -e D:\Temp\database\table.err -b 1000 -c -S server\instance -U sa -P
> password -E'
> BCP in syntax...
> exec master..xp_cmdshell 'BCP database..table in
> D:\Temp\database\table.txt
> -e D:\Temp\database\table.err -b 1000 -c -S server\instance -U sa -P
> password -E'
> BCP error...
> SQLState = 22005, NativeError = 0
> Error = [Microsoft][ODBC SQL Server Driver]Invalid character value for
> cast specification
> The data in the column it's giving the error on is: 0xFFFFFF7F
And the data type of the column is?
Even better, what is the definition of the two tables? Specifically,
are they identical? Please script both tables and post together with
some sample data that demonstrates the problem.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
2012年3月19日星期一
2012年3月11日星期日
BCP import error
I BCP out a table and then import back. While BCP IN, i get the following error:
#@. Row 303, Column 5: Invalid character value for cast specification @.#
#@. Row 296, Column 4: String data, right truncation @.#
Help plz!I think the data you try to insert into the table does not match the the ddl of the table itself. Are there any strange characters on row 303? What does row 303 look like anyway? The bcp-command you execute: does it consider strange characters and how does it map the file to the table? What's the layout of the table?|||Hi, thanx.
I don't suspect if there's any column binding problem, coz
I create a txt file from the same table, then truncate that table and import the data back from this text file.
The problem is multiple commas ",,," in the note-content column text.
Here's an example:
CREATE TABLE mydbo (id int, notedate datetime, note_content varchar(900), note_user char(3))
go
INSERT MYTAB
SELECT 1 , '2003-12-24 00:00:00' , 'AS PERINSTRUCTION ENTRD SC#@.12/16/03...71', 'SF2'
UNION ALL
SELECT 2 , '2004-02-07 00:00:00', 'CHECKED INF SCA@.#02/06/04.............17', 'SF2'
UNION ALL
SELECT 3 , '2004-03-26 00:00:00', 'GO TO, #, as per data .', 'SF2'
When i BCP out this table and then BCP into same table, i get the error for line 3. (right trucation)
How do i handle this, i have a CSV file that i have to import into a table, but data in single field contains multiple commas.
Howdy!|||Would it be possible for you to choose a different field seperator such as ; or [tab] ?
#@. Row 303, Column 5: Invalid character value for cast specification @.#
#@. Row 296, Column 4: String data, right truncation @.#
Help plz!I think the data you try to insert into the table does not match the the ddl of the table itself. Are there any strange characters on row 303? What does row 303 look like anyway? The bcp-command you execute: does it consider strange characters and how does it map the file to the table? What's the layout of the table?|||Hi, thanx.
I don't suspect if there's any column binding problem, coz
I create a txt file from the same table, then truncate that table and import the data back from this text file.
The problem is multiple commas ",,," in the note-content column text.
Here's an example:
CREATE TABLE mydbo (id int, notedate datetime, note_content varchar(900), note_user char(3))
go
INSERT MYTAB
SELECT 1 , '2003-12-24 00:00:00' , 'AS PERINSTRUCTION ENTRD SC#@.12/16/03...71', 'SF2'
UNION ALL
SELECT 2 , '2004-02-07 00:00:00', 'CHECKED INF SCA@.#02/06/04.............17', 'SF2'
UNION ALL
SELECT 3 , '2004-03-26 00:00:00', 'GO TO, #, as per data .', 'SF2'
When i BCP out this table and then BCP into same table, i get the error for line 3. (right trucation)
How do i handle this, i have a CSV file that i have to import into a table, but data in single field contains multiple commas.
Howdy!|||Would it be possible for you to choose a different field seperator such as ; or [tab] ?
订阅:
博文 (Atom)