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 |
micnie_2020
Posting Yak Master
232 Posts |
Posted - 2012-07-10 : 21:10:26
|
Hi All,select ConcatenateType=STUFF( ( select distinct ',' +aveva_revenuetypename from FilteredAP_forecastrevenue where aveva_revenuetypename IN ('Initial','Services','Training') and ap_referencenumber =[Deal Ref] FOR XML PATH('') ),1,1,''), ....from ..Anyone one know any other method can transform this result set? Above statement is taking too much of loading time to execute.Thank you |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-07-10 : 22:10:32
|
whats the record count against which you're running this?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2012-07-11 : 04:07:24
|
do it outside from the db then.What's consuming this?Transact CharlieMsg 3903.. The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION. |
 |
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-07-11 : 07:40:57
|
To rephrase Visakh's question - would the query take a long time if you simply did a select from the same table with the same where clause, but without the XML PATH concatenation?You may want to look at the so-called quirky update method, which I am told is very fast. See the last example in Madhivanan's blog here: http://beyondrelational.com/modules/2/blogs/70/posts/10865/quirky-update-in-sql-server.aspxI am not a great fan of this approach, but people whose opinions I respect very much seem to swear by it - see Jeff Moden's article here for example: http://www.sqlservercentral.com/articles/T-SQL/68467/ |
 |
|
|
|
|