What is equivalent to the EXPLAIN form of SQLite in SQL Server?

I used the SQLite database and ran the EXPLAIN statement before executing the actual query to check if there was an attempt to write to the database.

Now we have switched to SQL Server, and I need to know if the query is trying to write to the database or just a simple SELECT statement. I mainly try to avoid any malicious statements.

+6
sql-server sqlite explain
source share
2 answers

You can see the estimated query plan of any request in SSMS by clicking on the proposed query plan diagram.

See MSDN .


However, if the user should not write to the database, he should not have rights for this. Make sure that it belongs to a role that has limited permissions.

+8
source share

If you decide to go this route, you can do the following:

set showplan_xml on go set noexec on go select * from sysobjects go set noexec off go set showplan_xml off go 

This will return three result sets containing one XML column. The second result set is the query plan for the actual query (in this case, select * from sysobjects )

But, as noted in my comment, you would be better off not allowing users to make any changes.

It is also possible to create applications that are selected only "only", but also quite malicious. I could easily write a selection that locks every table in the database and takes an hour.

+3
source share

All Articles