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
 SQL Server Development (2000)
 dowt in Coalesce( ) function

Author  Topic 

iswan
Starting Member

28 Posts

Posted - 2007-06-15 : 05:09:45

I have a dowt in below code. When i print the '@FieldStr'. It is coming correctly. But '@FieldStr1' it is not coming correctly

declare @FieldStr varchar(5000)
declare @FieldStr1 varchar(5000)

select @FieldStr=Coalesce(@FieldStr + ',','')+a.fieldname,@FieldStr1=Coalesce(@FieldStr1 + ',','')+ case when b.fieldtype = 2 then convert(varchar,b.fld_int) when
b.fieldtype = 3 then CONVERT(VARCHAR,b.fld_date,101)
when b.fieldtype = 1 or b.fieldtype = 5 or
b.fieldtype = 7 or b.fieldtype = 9 or
b.fieldtype = 10 then b.fld_varchar end --as 'data'
from sctabfieldmaster a,ProjectFormData b where a.TmplFldID=b.templatefieldid and b.ProjectID=592
and b.levelid='1.1.9' and b.level2id=17

print @FieldStr
print @FieldStr1

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-06-15 : 05:25:18
quote:
Originally posted by iswan


I have a dowt in below code. When i print the '@FieldStr'. It is coming correctly. But '@FieldStr1' it is not coming correctly

declare @FieldStr varchar(5000)
declare @FieldStr1 varchar(5000)

select @FieldStr=Coalesce(@FieldStr + ',','')+a.fieldname,@FieldStr1=Coalesce(@FieldStr1 + ',','')+ case when b.fieldtype = 2 then convert(varchar,b.fld_int) when
b.fieldtype = 3 then CONVERT(VARCHAR,b.fld_date,101)
when b.fieldtype = 1 or b.fieldtype = 5 or
b.fieldtype = 7 or b.fieldtype = 9 or
b.fieldtype = 10 then b.fld_varchar else '' end --as 'data'
from sctabfieldmaster a,ProjectFormData b where a.TmplFldID=b.templatefieldid and b.ProjectID=592
and b.levelid='1.1.9' and b.level2id=17

print @FieldStr
print @FieldStr1




Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -