Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase ««12

t-sql trimming before and after stored proc name Expand / Collapse
Posted Friday, April 12, 2013 1:38 PM



Group: General Forum Members
Last Login: Today @ 2:46 PM
Points: 13,882, Visits: 35,811
yeah, but there's another version that supports varchar(max), which is the datatype for sys.sql_modules.definition;

it's effectively the exact same code but varchar(max) instead of varchar(8000)

good for massive strings you need to manipulate, but slower, obviously.


help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!
Post #1441897
Posted Monday, April 15, 2013 12:52 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, November 13, 2015 1:04 PM
Points: 9, Visits: 329
Thank you guys for all valuable feedback ...

following Query from Mansfield working gr8 in my scenario!!

SELECT ec.session_id,
s2.[text] as Last_Executed_SQL,
auth_scheme as Auth_Type,
es.login_name, as Stored_Procedure_Name
FROM sys.dm_exec_connections ec
OUTER APPLY sys.dm_exec_sql_text (ec.most_recent_sql_handle) as s2
LEFT JOIN sys.dm_exec_sessions es on (ec.session_id = es.session_id)
JOIN sys.sql_modules sm on sm.definition = s2.text
JOIN sys.objects ob on ob.object_id = sm.object_id
ORDER BY connect_time desc
Post #1442458
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse