View Single Post
 
Old May 6th, 2005, 10:53 AM
rajukurian rajukurian is offline
Authorized User
 
Join Date: May 2005
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default PLS HELP ME ..STRING CONCATINATION

Hi
        I am facing a problem in string concatination in sql server...i am taking 5 values from 5 diff columns...and i have to check if its not null then concatinate with "|"...

        select pgcd1 + "|"+ pgcd2 +"|" +pgcd3 + "|"+ pgcd4 as PGCD FROM TABLENAME...

         The problem i am facing is ...the "|" symbol should comes only in pictures if the field is having any value...

       desired output 1)- if ALL 3 fields r having values then

            pgcd1 | pgcd2 | pgcd3

 2) if first and last having values and second is null then

            pgcd1 | pgcd3

 3) IF FIRST IS NULL AND SECOND AND THIRD COLUMNS R HAVING VALUE THEN

            PGCD2 | PGCD3






   Can anybody help me....thx