I have a query I need to return a 0 if the value is NULL or non-existent. This is my query and it seems to work. I wanted to see if any experts out there have a better way.
sql server 2000
SELECT COALESCE(MAX(CONVERT(INT,variableValue)),0) FROM sysVar WHERE variableName = 'minThreshold'
If variableValue is null or if variableName 'minThreshold' is non-existent in sysVar, this query will return 0 as I need it to do. Is this the correct way to do this?
Thanks
sql server 2000
SELECT COALESCE(MAX(CONVERT(INT,variableValue)),0) FROM sysVar WHERE variableName = 'minThreshold'
If variableValue is null or if variableName 'minThreshold' is non-existent in sysVar, this query will return 0 as I need it to do. Is this the correct way to do this?
Thanks