sql-serversql-server-2012milestone

Find runtime value in SQL Server 2012


I need to found out what query is exactly running in background. after googled, i found below query.

SELECT sqltext.TEXT,req.session_id,req.status,req.start_time,
req.command,req.cpu_time,req.total_elapsed_time
FROM sys.dm_exec_requests req 
CROSS APPLY 
sys.dm_exec_sql_text(sql_handle) AS sqltext

I found out below query using above query.

SELECT count(*) from transaction 
WHERE (TransactionTimestamp between @StartDate and @EndDate) 

but i am not able to find what value is passing in @StartDate and @EndDate variable.

is there any way to find out run time value for these variable in Sql Server ?actually this query is triggered by MILESTONE application and user put start date and end date at milestone application. at database end, we need to check what date is provided by user ?


Solution

  • You can find it using profiler or extended events..

    below is small example using profiler

    enter image description here