How can I handle Key words in column Names?

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
kris18
Charter Member
Charter Member
Posts: 46
Joined: Mon Nov 13, 2006 9:53 am
Location: United States

How can I handle Key words in column Names?

Post by kris18 »

How can I handle Key words in column Names?
Foe example if I have the column name as KEY...when I run the job it's giving me the following error.
Dynamic_RDBMS_6: [DataDirect][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'KEY'.

By the by I am loading fron DB2 ===>SQL SERVER.(DRS STAGE)

Also is they any way to handle Special characters in the column names (EX:#).
Thanks
kris
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

KEY is, of course, a reserved word (PRIMARY KEY, FOREIGN KEY). Therefore to use it as an identifier, such as a column name, you need to enclose it in double quote characters.

Code: Select all

SELECT DORR_ID, "KEY", QTY FROM tablename;
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply