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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 order by

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2009-03-31 : 07:09:32
Hi,
I am working on an existing sql in a stored procedure (sp).
The select query in sp is something like:
select fields...
from tables...
inner join tables...

Then at the end it has FOR XML PATH(''fieldname''), elements xsinil, ROOT(''fieldname'')

Question:
How do I add an order by clause to this please?
Thanks

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2009-03-31 : 07:15:07
quote:
Originally posted by arkiboys

Hi,
I am working on an existing sql in a stored procedure (sp).
The select query in sp is something like:
select fields...
from tables...
inner join tables...

Then at the end it has FOR XML PATH(''fieldname''), elements xsinil, ROOT(''fieldname'')

Question:
How do I add an order by clause to this please?
Thanks




Hello,
I did this by placing the order by before the for xml bit and it works.

Thanks anyway
Go to Top of Page
   

- Advertisement -