SamCash
asked on
SQL syntax, SEL FROM sys.messages WHERE sys.messages.text LIKE ' %NULL%'
EE,
I am trying to SELECT all sys.messages that contain the text string 'NULL'.
First query shows there is at least 1, message_id = 515.
Second query does not return this record. I assume there are several messages with the word 'NULL'.
I am using SSMS.
Why does this not work or how do I get all the Records with 'NULL' in the string?
Regards
Sam
I am trying to SELECT all sys.messages that contain the text string 'NULL'.
First query shows there is at least 1, message_id = 515.
Second query does not return this record. I assume there are several messages with the word 'NULL'.
I am using SSMS.
Why does this not work or how do I get all the Records with 'NULL' in the string?
Regards
Sam
SELECT *
FROM sys.messages
WHERE message_id = 515
AND language_id = 1033
SELECT *
FROM sys.messages
WHERE
sys.messages.text LIKE ' %NULL%'
AND language_id = 1033
ORDER BY message_id
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If a value is truly NULL, the word NULL will not be found in a string. That means you can not use LIKE to find it. This page http://www.w3schools.com/sql/sql_null_values.asp discusses using and finding NULL values.
ASKER
Jim,
Thanks much. This is not the first time a 'space' has kept me going for hours.
Best Regards
Sam
Thanks much. This is not the first time a 'space' has kept me going for hours.
Best Regards
Sam
Thanks for the grade, good luck with your project. -Jim