IT ppl IT ppl - 9 months ago 32
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 ?


Maybe something like this:

INSERT INTO @FilteredTbl 
SELECT * FROM @MasterTbl AS tbl
ORDER BY tbl.OrderbyColumn