All Blond
All Blond

Reputation: 822

SQL Server 2008 syntax

I have the following as a part of a SELECT statement:

ISNULL(c.FirstName,'') + ' ' + ISNULL(c.LastName,'') as CustomerName,
CAST(isnull(lr.ReservationNames,'') as nvarchar(2000)) as HolderName

I wonder if there is a way to verify if this part is empty

CAST(isnull(lr.ReservationNames,'') as nvarchar(2000))

How can I assign CustomerName to it or in worse case scenario c.FirstName + ' ' + c.LastName ?

Thanks

lr is one of the JOIN tables in the SELECT obviously...

Upvotes: 0

Views: 35

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269803

Is this what you want?

CAST(isnull(lr.ReservationNames, ISNULL(c.FirstName,'') + ' ' + ISNULL(c.LastName,'')
           ) as nvarchar(2000)
    ) as HolderName

Upvotes: 3

Related Questions