Wednesday, July 8, 2015

SQL Like query

select login_id,first_name + ' ' + last_name as name,'0' as evuda,count(*) over () as [record_count]
from userinfo
where comp_id = @LoginCompId
and first_name like '%'+ isnull(ltrim(rtrim(@UserName)),first_name) +'%'  
or last_name like '%'+ isnull(ltrim(rtrim(@UserName)),last_name) +'%'

No comments:

Post a Comment