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 |
|
jim_jim
Constraint Violating Yak Guru
306 Posts |
Posted - 2011-05-12 : 09:09:01
|
Below is my query using stuff function which works fine when i concatenate a string column but get conversion error when trying the same on a integer column.QuerySELECT Distinct ReqInfo,STUFF(( SELECT ',' + RIDFROM Reports WHERE ReqInfo= A.ReqInfoFOR XML PATH('') ),1,1,'') AS CustIDFROM Reports AError MessageConversion failed when converting the varchar value ',' to data type int. |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-05-12 : 09:11:47
|
| SELECT Distinct ReqInfo,STUFF(( SELECT ',' + convert(varchar(n),RID)FROM Reports WHERE ReqInfo= A.ReqInfoFOR XML PATH('') ),1,1,'') AS CustIDFROM Reports AJimEveryday I learn something that somebody else already knew |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-05-12 : 09:12:26
|
convert(varchar(10),RID) No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-05-12 : 09:13:03
|
  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
jim_jim
Constraint Violating Yak Guru
306 Posts |
Posted - 2011-05-12 : 09:18:05
|
| Thank You ALL |
 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-05-12 : 09:26:49
|
| I'm going to start keeping track of how many times I've sniped you. Must be that your posts have further to travel!JimEveryday I learn something that somebody else already knew |
 |
|
|
jim_jim
Constraint Violating Yak Guru
306 Posts |
Posted - 2011-05-12 : 10:20:01
|
| you have been great to get me help whenever needed.I will also keep track of how many times you responded to my posts |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-05-12 : 10:21:20
|
quote: Must be that your posts have further to travel!
That's a fine excuse. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|
|
|