MS SQL: “if null then zero”

Problem:

Query nam vraća null, a nama treba nula

Rješenje:

Select coalesce(fieldName,0) as broj

ili

Select (case when fieldName is null then 0 else fieldName end)) as broj

ili

Select (IsNull(fieldName,0)) as broj

Leave a Reply

You must be logged in to post a comment.