freebcp bug when column name is 'group'

Ed Avis <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
I use freebcp with MS SQL server 2000.  It works well once you set TDSVER=8.0.
But MSSQL lets you create tables where the column name is an SQL reserved word
provided you quote the column name with [], for example

create table test ([group] int not null)

Interestingly if you double-quote it as "group" then you still get a syntax
error.  I don't know whether Sybase allows this [] style of quoting.  Anyway, I
can bcp out from this table:

% freebcp mydb..test out test -c -S MY_SERVER -U my_user -P my_pass

but when I try to run the same using 'in' instead of 'out', I get

Starting copy...
Msg 156, Level 15, State 1
Server 'WCL-SQL-PROD', Line 1
        Incorrect syntax near the keyword 'group'.
Msg 156, Level 15
General SQL Server error: Check messages from the SQL Server

bcp copy in failed

I wonder whether freebcp could quote the column name somehow to avoid this bug.
It's odd, because the bcp interface looks like a real API and isn't based on
gluing together strings of SQL.  But someone who knows more can comment.

If failure on a column name of 'group' is unavoidable, perhaps the 'bcp out'
command could give a warning that loading the file back in may not work.

-- 
Ed Avis <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.