Solved

How to get an ObjId if you have an SPID - Stored Procedure

Posted on 2010-08-26
1
1,118 Views
Last Modified: 2012-05-10
SQL Server 2000
I am working with detecting (in the future) an object name in a proc.

I'm working to have a proc that I can run and find the table that is locked.  I can run:

execute sp_Lock @vcSPID  
         where @vcSPID = the SPID from the locked process

Inside the table created by sp_Lock (in my case 13 records) I have an objId that equals = 0 on record 1 and the objId of the locked object in the field ObjId on the other records.  

I want to put that ObjId in a variable that I can use later SELECT object_name(@intObjId) .

Thanks in advance for any help.
LJG
I want to put
0
Comment
Question by:LJG
1 Comment
 
LVL 11

Accepted Solution

by:
Larissa T earned 500 total points
ID: 33535829
You can get result  from execute into table, then read data from it

insert into #tbl
execute sp_Lock @vcSPID  

table needs to be created to match result set returned from sp
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SQL Server RDS clr assembly 4 37
Backup Job question 4 20
Updating variable table 9 17
Data to display differently-SQL Server 4 19
In this article—a derivative of my DaytaBase.org blog post (http://daytabase.org/2011/06/18/what-week-is-it/)—I will explore a few different perspectives on which week today's date falls within using Microsoft SQL Server. First, to frame this stu…
When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now