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