Sql-server – Retrieve SQL statements – No backup, No query tracing

sql serversql-server-2012

I know that my question probably don't belong here but I would be really so thankful if someone has the skill for solving this out.

I have recently made several update statements that I shouldn't have done and would like to see their queries with parameters or at least something so I could retrieve the data back manually.

I'm able to access ::fn_dblog(NULL, NULL) and I would like to know if can I see the queries with parameters from there?

It could have been cca 200 statements.

I'm using SQL server 2012.

I don't have backup or query tracing ony my server.

Best Answer

See if the query plans are still in cache.

Adjust the datetime and query filter to suit what you know about the queries you ran

SELECT dest.text 
from sys.dm_exec_query_stats AS deqs 
cross APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest 
where deqs.last_execution_time > '15 may 2014 14:00' 
and dest.text LIKE '%UPDATE%'