Do queries in collapse reports select in the log?

I was wondering if the following SQL code would be stored in the log so that we could return to a future date to find out what the user typed when querying the database?

BEGIN TRAN SELECT * FROM pictures p INNER JOIN product pr ON p.item_id = pr.item_id ROLLBACK TRAN 

I think that if the code is wrapped in a rollback offer, will the record that the user typed be visible?

+5
source share
1 answer

In short, no. Since no data changes occur, there is no need to store anything in the log. In fact, the value of ROLLBACK does not matter, even if it is COMMIT ed, there are still no data changes and, therefore, are not logged.

DELETE , UPDATE and INSERT . SELECT no. If you want to register such queries, you can use tracing, use SQL Audit, create your own registration solution, or use a third-party product tool.

Here is some information about the different methods:

http://solutioncenter.apexsql.com/auditing-select-statements-on-sql-server/

Here is more information about SQL Audit:

http://blogs.msdn.com/b/sreekarm/archive/2009/01/05/auditing-select-statements-in-sql-server-2008.aspx

+1
source

Source: https://habr.com/ru/post/1214053/


All Articles