Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 What is wrong with this replace function?

Author  Topic 

eric@horwitzlaw.com
Starting Member

6 Posts

Posted - 2005-04-01 : 09:39:22
Hello people!

I am having a problem with this select statement. The first replace function works fine, but when i include the second replace function with a concatenation of another field (other than adversary), the others come up null on the outer edge of it.

THANKS!
Eric

select A.filenumber,
contact4.fname + ' ' + contact4.lname as 'CLIENT',
(select REPLACE(REPLACE(REPLACE(typelaw,9,'INJURY'),10,'WC'),7,'CONSUMER')) + ', ' + casetype as 'SCREEN - TYPE',
atty1 + ', ' + atty2 as 'ATTY1 - ATTY2',
(select replace(replace(replace(typelaw,7,adversary),9,adversary+cladv2),10,adversary + wcinc)) as 'Adv', contact4.lname + ',' + contact4.fname + '('+ substring(status,1,1) + '-' + (select REPLACE(REPLACE(REPLACE(typelaw,9,'CL'),10,'WC'),7,'CN')) + '-' + substring(atty1,1,5) + ')' + adversary
from page0 AS A,contact4 where A.client = contact4.linkserial

rfrancisco
Yak Posting Veteran

95 Posts

Posted - 2005-04-01 : 09:44:01
Try checking for NULL values because if you concatenate a NULL value to a string, the result is NULL. For each field that you use, make it ISNULL(<FieldName>, '') to replace any NULL values with an empty string.
Go to Top of Page
   

- Advertisement -