Concatenate filed and check null values
Today I have create one MS SQL Query with combination of three fields, Account no, First Name , Last Name and my table name is tblregister.
I have account no in my tblregistr table but I don’t have first name and last name so that column has null values.
I try with below query
select memberid,AccountNo,(cast(AccountNo AS varchar (15) )+’ - ‘+txtFirstname+’ ‘+txtLastname) as txtmembername from
tblregister
But member name is return as NULL while I have account no in my accountno column.
Then after I try with replace that also not work
Finally I try ISNULL and its Worked.
select memberid,AccountNo,(cast(AccountNo AS varchar (15) )+’ - ‘+ISNULL (txtFirstname,”)+’ ‘+ISNULL (txtLastname,”)) as
txtmembername from tblregister
Enjoy Programming