IT ppl IT ppl - 1 year ago 65
SQL Question

Insert into table from another table after sorting data of first table

I am doing something like this in SP,

insert into @FilteredTbl select * from @MasterTbl

but now problem is that i want data of @MasterTbl sorted before adding into @FilteredTbl,

How can I do that ?

Answer Source

Maybe something like this:

INSERT INTO @FilteredTbl 
SELECT * FROM @MasterTbl AS tbl
ORDER BY tbl.OrderbyColumn
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download