Ask a Question related to Coldfusion Database Access, Design and Development.
-
Pubcit #1
Concatenate fields with no values
I am running CF 5 with SQL Server 2000. I am looking to concatenate a person
name, but not all names have a suffix or middle name.
Sample SQL:
SELECT ID, Last_name + N' ' + Suffix + N', ' + First_Name + N' ' +
Middle_Name AS Full_Name
FROM tTable
ORDER BY ID
The problem is when someone does not have a suffix. The value of Full_Name
will then look like "Doe , John M." with an extra space after the last name.
Can I put in an IF statement in my SQL? This problem must be handled in the
SQL. Normally I would take care of this with CF code during the query output.
Pubcit Guest
-
Add values of two fields
Good day, I just want to know if it is possible using developers toolbox to sum values of two fields (field1 + field2 =field3) where field3 is the... -
Can you concatenate recordset values in one field?
Hi I have an Access db which stores, amongst other things, details of small mailing lists, people who have received a particular mailing. Because... -
Concatenate Fields to >255 chars
"Peter" <peter@somewhereontheinter.net> wrote in news:cuds3o$b3d$1@forums.macromedia.com: Hi Peter, Are you using cfinsert/cfupdate - or a... -
Concatenate column values from multiple rows
Greetings, Would it be possible to construct SQL to concatenate column values from multiple rows? SELECT ... FROM T1, T2 WHERE T1.key=T2.fkey... -
concatenate text fields
Does anyone know of a workaround to concatenate text fields???? thanks, jr -
mxstu #2
Re: Concatenate fields with no values
Try using CASE ....
SELECT Last_name + CASE Suffix WHEN '' THEN N'' ELSE N' '+ Suffix END .....
FROM tTable
ORDER BY ID
Or if the Suffix values are NULL (and not an empty string), you could also use
the COALESCE() function.
mxstu Guest



Reply With Quote

