David
David

Reputation: 73564

DB2 equivalent of [ColumnName]

In T-SQL, you can use square brackets to get around the fact that some DB Developer used a reserved keyword as a column name, or put a space in a column name as such:

Select [Date] as OrderDate From Orders

or

Select [Order Date] as OrderDate From Orders

I've been unable to find the equivalent for DB2.

We have a file that was set up long ago with fields that contains what I suspect are illegal characters FOR sql. The file works fine when accessing from RPG, but is throwing an error when accessing via SQL.

I've been unable to find documentation on this after much time spent on Google, Bing, and http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/rzahg/rzahgicca2.htm

Upvotes: 6

Views: 5194

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269633

Try using double quotes around the name.

Upvotes: 8

Related Questions