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 |
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2005-11-08 : 01:46:30
|
| Hi All,I have data in this format Loc1 Value 1 WC0011 WC00021 WC00032 WC00022 WC00082 WC0007Now i want the query for the data to be in this format Loc1 Value1 WC001@WC0002@WC00032 WC0002@WC0008@WC0007Any Sugesstions.. ??? |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2005-11-08 : 02:18:25
|
quote: Originally posted by madhivanan Refer thishttp://sqljunkies.com/WebLog/amachanic/archive/2004/11/10/5065.aspx?Pending=trueMadhivananFailing to plan is Planning to fail
Thanks Madhiivanan.. But I got it work through this function.. quote: CREATE FUNCTION dbo.ConcatLoclib4(@Loclib4 varchar(9), @ConString varchar) RETURNS VARCHAR(8000) AS BEGIN DECLARE @Output VARCHAR(8000) SELECT @Output = COALESCE(@Output+ @ConString, '') + CONVERT(varchar(20), Code) FROM dbo.[Loclib5] WHERE CodeLib4 = @Loclib4 RETURN @Output END
Complicated things can be done by simple thinking |
 |
|
|
|
|
|