I have a query where I'm selecting more than 15 things, and thus getting (more than) 15 columns in my results. Some of the things I've selected are big CASE statements. T-SQL of course displays your result in the order than you list things in the SELECT
statement.
Is there a way to have the result columns displayed in a different order to help with my review of them, without
a) re-ordering how they were selected (because I'll need to do this every time I want to compare two other columns side-by-side)
i.e. Don't want to change: SELECT a,b,c,d,e,f
to SELECT f,d,a,b,c,e
since a-f can each be 5-10 lines of code
b) drag-n-drop column in the results next to each other, because if I want column 2 to be next to column 9 and column 14, and all three to be at the end of the result table, then that'd a lot of dragging to do.
c) knowing the column number of what was selected as opposed to the column name
What I'm looking for is something that resembles:
Select
vi.Name
,vi.Height
,vi.Power
,case when tt.losses < 3
then 'Y'
else 'N'
end as MasteryKen
,tt.blahnum
,vi.blahtext
,vi.blahdate
,vi.blahcalc
,tt.blahflag
,vi.blahflag
,vi.blahcompare
From SenshiVitalInfo vi
Join TatakauTable tt
on vi.namecd=tt.namecd
OrderOutputResults by tt.blahflag, vi.blahflag, *
Does a function to do the last line exist in T-SQL (SQL Server 2008)?