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.
Author |
Topic |
almir
Starting Member
10 Posts |
Posted - 2007-05-22 : 04:26:48
|
I would appreciate any help with the following problem:Select f1 + ' ' + f2 + ' ' + f3 as textBody,t3.IDf from t1 inner join t2 on t1.IDf1 = t2.IDf1 inner join t3 on t2.IDf2 = t3.IDf2This select statement will sometimes return more than one record. I would like to concatenate textBody again in a single field and return one extra field.All of this is run in .net windows forms app and executed with executenonquery method of the command object.Any help will be greatly appreciated.Ooops there was an error in select statement, it has been corrected now (for 5 people who read this before correction) |
|
shallu1_gupta
Constraint Violating Yak Guru
394 Posts |
Posted - 2007-05-22 : 05:30:13
|
try this..declare @TextBody varchar(4000), @Idf varchar(100)select @TextBody = coalesce(@TextBody + ' ' + f1 + ' ' + f2 + ' ' + f3 , f1 + ' ' + f2 + ' ' + f3 ), @Idf = t3.IDf from t1 inner join t2 on t1.IDf1 = t2.IDf1 inner join t3 on t2.IDf2 = t3.IDf2select @Name, @Idf |
 |
|
|
|
|