Traditionally, I will use
sp_helptext sp_lock
to get the source code and retrieve the column metadata of the result set, and then build a table
insert into newly_created_table exec sp_lock
Now I simply use the following way
select * into newly_created_table from OpenRowSet('SQLCLI', 'Server=MyServer;Trusted_Connection=yes;', 'exec sp_lock')
Of course, it does not mean you can use this method to dump result set of all SPs, for example, sp_who2 is an exception.



Subscribe to this blog
Briefcase
Print
No comments.