freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Ed Avis <eda AT waniasset.com>
- To: freetds AT lists.ibiblio.org
- Subject: [freetds] freebcp bug when column name is 'group'
- Date: Mon, 14 Mar 2011 15:38:11 +0000 (UTC)
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 <eda AT waniasset.com>
-
[freetds] freebcp bug when column name is 'group',
Ed Avis, 03/14/2011
- Re: [freetds] freebcp bug when column name is 'group', Thompson, Bill D (London), 03/15/2011
Archive powered by MHonArc 2.6.24.