1. Rick Domogalik
  2. PowerBuilder
  3. Thursday, 9 December 2021 14:58 PM UTC

I have a legacy database that I am writing a new interface for.  This database has several tables that use the column name "Print".  I cannot change the name of the column in the database.  I need to be able to update and insert new data in these tables using the reserved word as a column name.  I have tried putting [] around the name in the SQL select and this will allow me to retrieve data, but when I go to try to insert a new record and then update, I get a sql error.

 

SQLSTATE = 37000
[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'print'.

No changes made to database.

 

Anyone know any tricks to get around this issue?

 

Thanks

 

Rick

Ronnie Po Accepted Answer Pending Moderation
  1. Thursday, 9 December 2021 15:08 PM UTC
  2. PowerBuilder
  3. # 1

Hi Rick,

Did you try putting double quotes (e.g. "print") around the column name?

Comment
  1. Sivaprakash BKR
  2. Saturday, 11 December 2021 06:10 AM UTC
One can try '[" ( Square bracket ) also in place of a double quote.

  1. Helpful
  1. Olan Knight
  2. Saturday, 11 December 2021 16:03 PM UTC
In the database profile on the SYNTAX tabpage there is an option "Enclose table and column name in quotes".

Normally, I hate this option, but in YOUR case you can check this option, then regenerate.

Your code will now look like "table_1"."column_A", and that should allow you to process those columns using reserved words as their column names.

If you only have one column in one table that uses a reserved word as it's column name, then this solution is overkill.

  1. Helpful 1
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.