sql server - select query, compare null records -



sql server - select query, compare null records -

i'm writing sql server query:

select * vwapplicationlist status='unassigned' , bbl '%' + @bbl + '%' , unitorappartmentnumber '%'+@appartment+'%' , residencetypedescription '%'+@residencetypedescription+'%' , sn1 '%'+@sn1+'%' , sn2 '%'+@sn2+'%'

the problem field "sn2" null in several records. how can compare them?

if want positive result on comparison:

... , coalesce(sn2, @sn2) '%' + @sn2 + '%'

if want negative result (assuming @sn2 not empty string):

... , coalesce(sn2, '') '%' + @sn2 + '%'

sql-server select null

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -