2012年2月23日星期四

BCP and keyword column names

When trying to import data from a text file using BCP (where one of the
column names of the table is the keyword 'Key'), I get a syntax error which
is to be expected. For keyword table names, you use [tablename] in the bcp
command. Is there a special command that I can use that will do something
similar for keyword column names?You can specify the '-q' BCP parameter to SET QUOTED_IDENTIFIER ON.
Also, it's a good practice to avoid using reserved words as column and
object names.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Hielien" <Hielien@.discussions.microsoft.com> wrote in message
news:0B8AE489-061B-4F4E-B954-FF4439A1D5AD@.microsoft.com...
> When trying to import data from a text file using BCP (where one of the
> column names of the table is the keyword 'Key'), I get a syntax error
> which
> is to be expected. For keyword table names, you use [tablename] in the
> bcp
> command. Is there a special command that I can use that will do something
> similar for keyword column names?|||Thanks!! Can't believe it is that easy... If I had a choice, I wouldn't use
reserved words. Unfortunately the database that I have to connect to,
already have such columns names... :)
"Dan Guzman" wrote:
> You can specify the '-q' BCP parameter to SET QUOTED_IDENTIFIER ON.
> Also, it's a good practice to avoid using reserved words as column and
> object names.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Hielien" <Hielien@.discussions.microsoft.com> wrote in message
> news:0B8AE489-061B-4F4E-B954-FF4439A1D5AD@.microsoft.com...
> > When trying to import data from a text file using BCP (where one of the
> > column names of the table is the keyword 'Key'), I get a syntax error
> > which
> > is to be expected. For keyword table names, you use [tablename] in the
> > bcp
> > command. Is there a special command that I can use that will do something
> > similar for keyword column names?
>
>

没有评论:

发表评论