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 error - skipping columns

Author  Topic 

jamie
Aged Yak Warrior

542 Posts

Posted - 2005-06-01 : 11:05:07
Hi,
when I try to run a bcp command with a format file I receive the followin error :

Error = [Microsoft][ODBC SQL Server Driver]Host-file columns may be skipped only when copying into the Server

my format file looks like :
8.0
5
1 SQLCHAR 0 4 "\t" 1 [Block External system ID] SQL_Latin1_General_Cp437_Bin
2 SQLCHAR 0 40 "\t" 2 [Location Name] SQL_Latin1_General_Cp437_Bin
3 SQLCHAR 0 40 "\T" 3 [Location Reference] SQL_Latin1_General_Cp437_Bin
4 SQLCHAR 0 20 "\T" 4 [Floor Area] SQL_Latin1_General_Cp437_Bin
5 SQLCHAR 0 20 "\t" 5 [Floor Level] SQL_Latin1_General_Cp437_Bin



my bcp command is :

DECLARE @FileName1 varchar(100),
@FileName2 varchar(100),
@bcpCommand1 varchar(2000)

SET @FileName1 = 'e:\LOCATIONS.txt'
SET @FileName2 = 'e:\Locations.fmt'

SET @bcpCommand1 = 'bcp "exec Location" queryout "'
SET @bcpCommand1 = @bcpCommand1 + @FileName1 + '" -f"' + @FileName2 + '" -Usa -Ppassword'

EXEC master..xp_cmdshell @bcpCommand1
any ideas ?

jamie
Aged Yak Warrior

542 Posts

Posted - 2005-06-02 : 06:07:55
Hi, I now receive tje error :
Error = [Microsoft][ODBC SQL Server Driver]Incorrect host-column number found in BCP format-file
It could be because I am tuncating some fields...
I need a fixed width text file.
Go to Top of Page
   

- Advertisement -