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
 Import/Export (DTS) and Replication (2000)
 BCP I/O Error

Author  Topic 

THNQdigital
Starting Member

15 Posts

Posted - 2004-05-20 : 05:47:09
Hi All,

i have a table with identity column( SQL server 2K). I am using BCP utility to insert data with format file and a flat file(.dat). Inside the format file i have omitted the identity column. and Inside the data file also i do not have anything corresponding to identity column.. ie ( Format and data file match in terms of number fo columns , order, type etc)
When i try to run BCP ( from a batch file) i get an error like below

"SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]I/O error while reading BCP format file"

DO i need to create a view and then insert in to that?.. please let me know
Thanks
THNQdigital


nr
SQLTeam MVY

12543 Posts

Posted - 2004-05-20 : 05:49:10
This means it's an error reading the format file - probably wrong format rather than an error importing.

To omit identities I usually import into a view - it's simpler.
see
http://www.nigelrivett.net/BCP_quoted_CSV_Format_file.html

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

THNQdigital
Starting Member

15 Posts

Posted - 2004-05-20 : 08:40:53
Hi NR,

Tried but no luck.. have attached my format file. the data file to be loaded will have all the columns values except for the first column which is a identity column. i tried view as well. but it says " I/O error agaian" if i use "bulk insert" it say's OS error can not open format file.. but for other format files it does not have any issue..
Please help


8.0
12
1 SQLCHAR 0 50 "," 2 hHospID Latin1_General_CI_AS
2 SQLCHAR 0 25 "," 3 hFirst_name Latin1_General_CI_AS
3 SQLCHAR 0 20 "," 4 hLast_name Latin1_General_CI_AS
4 SQLCHAR 0 80 "," 5 hAddress Latin1_General_CI_AS
5 SQLCHAR 0 15 "," 6 hTel Latin1_General_CI_AS
6 SQLCHAR 0 15 "," 7 hmobile Latin1_General_CI_AS
7 SQLCHAR 0 30 "," 8 hEmail Latin1_General_CI_AS
8 SQLCHAR 0 15 "," 9 hZip Latin1_General_CI_AS
9 SQLCHAR 0 50 "," 10 hCity Latin1_General_CI_AS
10 SQLCHAR 0 50 "," 11 hState Latin1_General_CI_AS
11 SQLCHAR 0 50 "," 12 hCountry Latin1_General_CI_AS
12 SQLCHAR 0 1 "\r\n" 13 hSex Latin1_General_CI_AS

Thanks
THNQdigital
Go to Top of Page
   

- Advertisement -