Question on querying two specific columns from sys.columns
I am trying to query the default and null columns from sys.columns. Both of these are sql key words, so queries either don't work or return the wrong value. Doing a "select default from ss.columns;" returns "syntax error, unexpected DEFAULT in: "select default"" error. Doing a "select null from sys.columns;" returns null for all records, even though it is a Boolean column with true/false values. I am currently working around this by doing "select *" and pulling out the relevant fields, but, I want to protect against a future release possibly changing the column ordering or changing the number of columns in this table (without also requiring an update to our code). Is there a way to escape the column names in a way that gives me what I want? Thanks, Dave
Hi Dave!
Use doble quote for column names ... you should try the following
select "null", "default" as "this is default" from sys.columns
Rgds
Ariel
On Wed, Aug 7, 2019 at 5:31 PM Gotwisner, Dave
I am trying to query the default and null columns from sys.columns. Both of these are sql key words, so queries either don’t work or return the wrong value.
Doing a “select default from ss.columns;” returns “syntax error, unexpected DEFAULT in: “select default”” error.
Doing a “select null from sys.columns;” returns null for all records, even though it is a Boolean column with true/false values.
I am currently working around this by doing “select *” and pulling out the relevant fields, but, I want to protect against a future release possibly changing the column ordering or changing the number of columns in this table (without also requiring an update to our code).
Is there a way to escape the column names in a way that gives me what I want?
Thanks,
Dave _______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
participants (2)
-
Ariel Abadi
-
Gotwisner, Dave