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 |
|
Incognito
Starting Member
49 Posts |
Posted - 2002-01-21 : 03:23:35
|
| Hello,I succeed with your assistence to write the right code to bring sereval columns with the same ID together. My code is:DECLARE @Data varchar(4000)SELECT @Data = COALESCE(@Data + ', ', '') + CAST(Data AS varchar(4000))FROM oedmisko01WHERE kontaktnummer = '1000793'Order By Kontaktnummer, SegmSELECT @DataBut there is one little problem. Let say ID = 1000793 en there are 5 data's for this ID. If the second data is longer then 255(the actual size of the colum) caracters it replaces the previous data. (Example:ID Data1 Testing answers1 and problemsThen the code does:Testing asnw(replaces ers) and problems.Can somebody help me out?Thnx a lot! |
|
|
Nazim
A custom title
1408 Posts |
Posted - 2002-01-21 : 03:52:02
|
Was wondering how can your field contain Data more then its Actual length?.quote: But there is one little problem. Let say ID = 1000793 en there are 5 data's for this ID. If the second data is longer then 255(the actual size of the colum) caracters it replaces the previous data.
--------------------------------------------------------------Dont Tell God how big your Problem is , Tell the Problem how Big your God is |
 |
|
|
Incognito
Starting Member
49 Posts |
Posted - 2002-01-21 : 04:32:02
|
| Ok you are the guru, you are the master. You are the Gohan of this forum. Only thing which I can say is SOS. Help me out...DECLARE @Data varchar(255)SELECT @Data = COALESCE(@Data + ', ', '') + CAST(Data AS varchar(255))FROM oedmisko01WHERE kontaktnummer = '1000793'Order By Kontaktnummer, SegmSELECT @DataIs this OK for you? |
 |
|
|
Incognito
Starting Member
49 Posts |
Posted - 2002-01-21 : 06:09:16
|
| Waitin for answers from the master! |
 |
|
|
Nazim
A custom title
1408 Posts |
Posted - 2002-01-21 : 07:30:23
|
Firstly, my no. of post gives me the Title of Guru not my knowledge about Sql. so dont take me to be one. another am a Yak Guru not a Sql Guru Can you Omit that Order by clause? . [quoteSELECT @Data = COALESCE(@Data + ', ', '') + CAST(Data AS varchar(255))FROM oedmisko01WHERE kontaktnummer = '1000793'[/quote]post your table schema(create table statment) with inserts (with your actual data) and also post the result you expect. if this doesnt works.--------------------------------------------------------------Dont Tell God how big your Problem is , Tell the Problem how Big your God isEdited by - Nazim on 01/21/2002 07:32:54 |
 |
|
|
|
|
|
|
|