How can I validate sql scripts before executing them using .net 2.0 and c#?
If the sql is not valid I want to return error rows.
What does 'valid' SQL mean? The syntax or the results?
The only sure way to validate the syntax is the execute the SQL in SQL Server. Have you considered running the SQL in a Transaction and then do a rollback at the end?
Begin Transaction
--execute your code between the 'Begin Transaction' and the 'rollback' keywords.
...
--example
Insert into mytable(ID)Values(2)
...
Rollback
MSDN Documentation on rollback