sql - Using a select case statement to compare field values -


i using select case statement compare 2 columns. 1 value returned table valued function , other database column. if first value of preferred first name null need show value of firstname view aliased column. dont know if syntax right. can tell me if right , or better way it?

(select       case when (         select asstring         dbo.getcustomfieldvalue('preferred first name', view_attendance_employees.filekey)      ) = null   view_attendance_employees.firstname     else (         select asstring        dbo.getcustomfieldvalue('preferred first name', view_attendance_employees.filekey))    end) firstname, 

you can use isnull function here:

select isnull(.. massive subquery here..., firstname) 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -