Friday, February 24, 2012

how to SET CONCAT_NULL_YIELDS_NULL OFF?

I'm writing a select query that's, in effect, like this: Select FirstName + ' ' + LastName FROM Users.

How do I get just the first name to display in my gridview if last name is null?

I'm familiar with aspx and aspx.cs files, but stored procedures are beyond me right now.

You need to use ISNULL or COALESCE.

Select FirstName + ' ' + ISNULL(LastName,'') FROM Users

No comments:

Post a Comment