Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • output of 2nd query seems correct. but why it is not returning 'not null' as ISNULL(NULL,'') will return '' and we are checking it against 0. Commented Dec 19, 2017 at 9:28
  • @RajanPatel your code asks for '' to be converted to 0 before checking. Why aren't you using IS NULL ? Why the convertion to '' and then to int? Commented Dec 19, 2017 at 9:29
  • @RajanPatel - because in first case it comparing with numeric vlaue thats why it get worked ..you can tried first case like this CASE ISNULL(@Test, 1) WHEN 0 THEN 'null' ELSE 'not null' Commented Dec 19, 2017 at 9:35