Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 How to Get Current Table Used?

Author  Topic 

jooorj
Posting Yak Master

126 Posts

Posted - 2011-04-27 : 04:33:59
How to Get Current Table Used by user_name

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-04-27 : 05:04:53
Your question doesn't make sense. Please expand.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2011-04-27 : 05:22:01
Joorj, you are asking a lot of questions lately that have the answer in Books Online.
Give Books Online a try!

There is no "current" table used by a user. How do you decide which is "current" table in a multi-table join?



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

eralper
Yak Posting Veteran

66 Posts

Posted - 2011-04-27 : 10:28:39
If you mean to find the table name in a DDL trigger then you can use the EVENTDATA() and parse for object name like the sample at [url]http://www.kodyaz.com/articles/prevent-drop-table-using-sql-server-ddl-trigger.aspx[/url]

-------------
Eralper
http://www.kodyaz.com
Go to Top of Page

Jahanzaib
Posting Yak Master

115 Posts

Posted - 2011-04-27 : 10:54:11
SELECT ST.TEXT,SP.CMD,SP.LOGINAME FROM SYS.SYSPROCESSES SP
CROSS APPLY SYS.DM_EXEC_SQL_TEXT(SP.SQL_HANDLE) ST
WHERE ST.TEXT LIKE '%YOUR TABLE NAME%'

Regards,

Syed Jahanzaib Bin Hassan
MCTS,MCITP,OCA,OCP,OCE,SCJP,IBMCDBA

My Blog
www.aureus-salah.com
Go to Top of Page

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2011-04-27 : 10:59:53
Jahanzaid, did u read the question ?

--------------------------
http://connectsql.blogspot.com/
Go to Top of Page
   

- Advertisement -