Julie -
You are JulieReffic.
Matt
-----Original Message-----
From: Julie Ungerecht [mailto:JUnger@c...]
Sent: Tuesday, November 19, 2002 11:15 AM
To: professional vb
Subject: [pro_vb] RE: YASQLQTDNBHBILTFAIHTYWFM
Assuming this is SQL Server try this...
Select Firstname + ' ' + ISNULL(LastName, '') from TableName
-----Original Message-----
From: Matt Morgan [mailto:mattmorgan@p...]
Sent: Tuesday, November 19, 2002 11:14 AM
To: professional vb
Subject: [pro_vb] YASQLQTDNBHBILTFAIHTYWFM
Hello all -
OK, here's the deal. I have a table; with 2 varchar fields; firstname
and
lastname.
If this is a commercial customer, then the first name will contain the
entire name; ex: Mcdonalds Hamburgers. Last name will contain Null.
If this is a residential customer, then the first name will be the
customers first name ex: Mary, and the last name will be the customers
last name, ex: Jones.
Now, in the SQL statement, I'd like to always return the full name,
regardless of commercial or residential status. So I try:
Select Firstname + ' ' + LastName from TableName
Which works for residential customers, but not for commercial customers.
For commercial customers, the query returns null because (I Assume
anyway):
McDonalds Hamburgers + ' ' + Null =3D Null
So, I guess I'm looking for a different concatenation operator. '&'
doesn't seem to work. I don't however think this is possible as it seems
to me that Null concatenated with anything will return Null.
Other than that, the only thing I can think of is to concatenate in code
(which for my purposes would not work), or make the default value of the
field something other than Null... maybe a space or something?
Any other ideas out there?
Thanks Much
Matt
P.S.
Yet Another SQL Question That Does Not Belong Here But I Like This Forum
And I Hope That You Will Forgive Me