Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 BCP and BULKINSERT

Author  Topic 

bridge
Yak Posting Veteran

93 Posts

Posted - 2005-09-30 : 07:06:13
when I bcp out a table in a text file which has a column of datatype text. I can not import that txt file got error of data type mismatch. Also please tell me how can I export data to file using BCP utility which is comma seperated and text values in double quotes.

paulrandal
Yak with Vast SQL Skills

899 Posts

Posted - 2005-10-01 : 10:48:04
(Obvious qustions first...)
Did you generate a format file during the bcp out, and are you using it to bcp in again? Does the table you're bcping into have the same schema as the one you exported from?

Can you post the format file and the error message?

Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
(Legalese: This posting is provided "AS IS" with no warranties, and confers no rights.)
Go to Top of Page

bridge
Yak Posting Veteran

93 Posts

Posted - 2005-10-03 : 02:49:40
I am not using any format file while exporting data. And yes both the source and destination tables have the same schema.
Go to Top of Page

paulrandal
Yak with Vast SQL Skills

899 Posts

Posted - 2005-10-03 : 14:15:54
My guess is that a text value contains a character that BCP is using as a column delimiter, and so you're getting the mismatch.

What happens if you try to BCP into the source table? My guess is it will fail too. What format mode are you using (char, nchar, native)?

Have you studied the examples in Books Online?

Thanks

Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
(Legalese: This posting is provided "AS IS" with no warranties, and confers no rights.)
Go to Top of Page
   

- Advertisement -