Sunday, February 12, 2012

Concatenation

Hello all,
I'm trying to combine two columns of data into a third column using a formula on the thrid column. Each of the columns could contain nulls and each of the columns could contain padding after or before the data. I'm trying to use the following formula yet SQL is throwing an error. Can someone provide another set of eyes to check this out?
ISNULL(LTRIM(RTRIM([user_Define_4a])),'') + ISNULL(LTRIM(RTRIM([user_Define_1])),'')
Thanksyou need to do the ISNULL before then TRIM. this is because a null value cannot be trimmed and should be converted to an empty string first. try:
LTRIM(RTRIM(ISNULL([user_Define_4a],''))) + LTRIM(RTRIM(ISNULL([user_Define_1],'')))|||Thank you. It works like a champ.

No comments:

Post a Comment