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
Post a Comment