dbTalk Databases Forums  

Re: Field names == SQL keywords - can we get around this?

comp.databases.btrieve comp.databases.btrieve


Discuss Re: Field names == SQL keywords - can we get around this? in the comp.databases.btrieve forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Greg D
 
Posts: n/a

Default Re: Field names == SQL keywords - can we get around this? - 11-09-2006 , 06:49 PM






As far as I can tell, in general, the pervasive engine is not that
intelligent.

You can put double quotes around column names to prevent conflicts with
using reserved words as column names.

SELECT "desc" FROM "user" WHERE "min" = 10

"seetickets" <glyn (AT) wayahead (DOT) com> wrote

Quote:
Hi People,

We are converting over to Pervasive SQL v9.5 on Novell from a database
system called DataFlex, I've just run a test on all the fields and
database names we use to check if they are the same as SQL keywords,
and there are tons of them.

Does anybody know if this will cause us massive problems in the future?
or can we get around this by encapsulating the field with characters
such as '' or [] ?

i.e surely doing:

SELECT desc FROM user WHERE min = 10

would be a massive pain in the ass?

would we be able to get by without any problems by doing for example:

SELECT 'desc' FROM 'user' WHERE 'min' = 10

Or is the pervasive engine intelegent enough to get by?

Any advice on this would be a great help.


Cheers




Reply With Quote
  #2  
Old   
Bill Bach
 
Posts: n/a

Default Re: Field names == SQL keywords - can we get around this? - 11-10-2006 , 02:22 PM






Surrounding any fields with double-quotes (i.e. "fieldname") would work
around this. In fact, it is possible with this to even write fun
queries like:
SELECT "SELECT" FROM "FROM" WHERE "WHERE" = 'WHERE'
Note that the final string in single quotes in a literal string, and
NOT a field name. This is the difference between single and double
quotes.


This will not cause massive problems (any many report builders
automatically add double-quotes anyway), but may be more painful for
users and SQL developers. Renaming the fields is a good idea if you
can do it.
Goldstar Software Inc.
Pervasive-based Products, Training & Services
Bill Bach
BillBach (AT) goldstarsoftware (DOT) com
http://www.goldstarsoftware.com
*** Chicago: Pervasive Service & Support Class - 03/2007 ***


seetickets wrote:

Quote:
Hi People,

We are converting over to Pervasive SQL v9.5 on Novell from a database
system called DataFlex, I've just run a test on all the fields and
database names we use to check if they are the same as SQL keywords,
and there are tons of them.

Does anybody know if this will cause us massive problems in the
future? or can we get around this by encapsulating the field with
characters such as '' or [] ?

i.e surely doing:

SELECT desc FROM user WHERE min = 10

would be a massive pain in the ass?

would we be able to get by without any problems by doing for example:

SELECT 'desc' FROM 'user' WHERE 'min' = 10

Or is the pervasive engine intelegent enough to get by?

Any advice on this would be a great help.


Cheers


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.