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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 How to Get Current Table Used?
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jooorj
Posting Yak Master

126 Posts

Posted - 04/27/2011 :  04:33:59  Show Profile  Visit jooorj's Homepage  Reply with Quote
How to Get Current Table Used by user_name

GilaMonster
Flowing Fount of Yak Knowledge

South Africa
4507 Posts

Posted - 04/27/2011 :  05:04:53  Show Profile  Visit GilaMonster's Homepage  Reply with Quote
Your question doesn't make sense. Please expand.

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

SwePeso
Patron Saint of Lost Yaks

Sweden
30421 Posts

Posted - 04/27/2011 :  05:22:01  Show Profile  Visit SwePeso's Homepage  Reply with Quote
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 - 04/27/2011 :  10:28:39  Show Profile  Reply with Quote
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 http://www.kodyaz.com/articles/prevent-drop-table-using-sql-server-ddl-trigger.aspx

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

Jahanzaib
Posting Yak Master

Pakistan
115 Posts

Posted - 04/27/2011 :  10:54:11  Show Profile  Visit Jahanzaib's Homepage  Reply with Quote
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

Pakistan
885 Posts

Posted - 04/27/2011 :  10:59:53  Show Profile  Visit lionofdezert's Homepage  Send lionofdezert a Yahoo! Message  Reply with Quote
Jahanzaid, did u read the question ?

--------------------------
http://connectsql.blogspot.com/
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000