views:

145

answers:

3

My app has an advanced feature that accepts SQL queries written by the user. The feature should include a "Validate" button to check if the query is valid.

The most simple way I found to do this using ADO is just trying to run the query and catch possible exceptions. But how can I also check if the query enables to add new records or to edit existing ones?

A: 

Transactions, anyone?

begin transaction

// Query being validated goes here

rollback transaction
Anton Gogolev
A: 

You can try to run the query with "SET NOEXEC ON" .

Joel Coehoorn