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 all columns

Author  Topic 

ashraff87
Starting Member

17 Posts

Posted - 2009-02-05 : 05:48:01
Hi im testing many sprocs to check they output the same with some old sprocs, the ordering of the sprocs doesnt matter, but to compare i need them in the same order so i can do a row by row compare.

so when running the sql i need to add ORDER BY [col1], [col2] .., [col N]

i dont want to have to type out all the column names in the order by for each one, i just want a generic, "order by all columns" clause that will do this for anything.

Thanks.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-02-05 : 05:52:51
There is no such thing.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2009-02-05 : 06:10:16
If you bother to count the columns first you can do a ORDER BY 1, 2, 3, 4, n. Another way to compare the output is to take both result sets in to Excel and do some simple checksums...sum up all identities for example and verify that the sum is matching in both both result sets.

- Lumbago
Go to Top of Page
   

- Advertisement -