March 8, 2007 at 9:12 am
I NEED TO KNOW USING T-SQL THE PROCESS ID FROM THE CURRENT SESSION CONNECTED TO SQL. EXIST SOMETHING LIKE @@SERVERNAME, SELECT USER.
I HAVE TO USE THI COMMAND IN A .NET APPLICATION TO RETRIEVE THIS INFORMATION.
THANKS FOR ANY SUGGESTION.
March 8, 2007 at 1:44 pm
Did you try SELECT * FROM master..sysprocesses?
March 8, 2007 at 2:22 pm
sp_who2 ????? It's hard to tell what you are really looking for. Can you be more specific?
-SQLBill
March 8, 2007 at 3:20 pm
I have found sp_who2 to generate better results, but it does not take parameters well...
I wasn't born stupid - I had to study.
March 8, 2007 at 7:12 pm
SELECT @@SPID
--Jeff Moden
Change is inevitable... Change for the better is not.
March 9, 2007 at 2:18 am
SELECT
spid, rtrim(status) as status, RTRIM(loginame) AS loginame, rtrim(hostname) as machine,
rtrim(CONVERT(char(5), blocked)) AS blk, DB_NAME(dbid) AS dbname, rtrim(program_name) as programa,cmd,
physical_io
, memusage,open_tran,net_library,login_time as TiempoInicio,last_batch as UltimoBach
FROM master.dbo.sysprocesses a where ecid = 0 and RTRIM(loginame) = 'XXXX'
This query return the same result that sp_who2 and 'XXXX' is to filter result for user connect to database.
Column spid is process number
March 9, 2007 at 4:03 am
March 9, 2007 at 8:58 pm
Like I said....
http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=9&messageid=350069#bm350229
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply