Declare cursor CUR ...
....
For select * from (sp_lock)
Fetch next from CUR into
@spid, @dbid, ...
My intention is to loop through the results return by
sp_lock for further processing. I still can't a way to do
it.
Thanks for any advice!
--
Dejan Sarka, SQL Server MVP
FAQ from Neil & others at: http://www.sqlserverfaq.com
Please reply only to the newsgroups.
PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org
"Chuen Cain" <seo...@magix.com.sg> wrote in message
news:1c0b01c2b6f0$a3127fa0$cef82ecf@TK2MSFTNGXA08...
>
> In my procedure, I need to use the results returned by
> sp_lock for further processing. It is similar to a SELECT
> on OPENQUERY(). For example,
>
> Declare cursor CUR ...
> ...
Anyway, it still works. Thanks!
>.
>
You can do it using a workaround, which I would not recommend. You can
define local server as a linked one and then use openquery:
EXEC sp_addlinkedserver
@server='newname',
@srvproduct='',
@provider='SQLOLEDB',
@datasrc='servername'
GO
SELECT *
FROM OPENQUERY(newname,'EXEC sp_lock')