Swim in SQL server

–With Text:
SELECT
                 qs.sql_handle,qs.statement_start_offset,qs.statement_end_offset,
                 qs.creation_time,qs.last_execution_time,qp.dbid,qp.objectid
FROM      sys.dm_exec_query_stats AS qs
                 CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS st
                 CROSS APPLY sys.dm_exec_text_query_plan(qs.plan_handle, DEFAULT, DEFAULT) AS qp
WHERE  st.text like '%S_GET_SerialNos%'
 
 
–Tip2:
SELECT      db_name(database_id) DatabaseName, object_name(object_id) ObjectName, *
FROM          sys.dm_exec_procedure_stats
WHERE      database_id = DB_ID()
ORDER BY database_id

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: