Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to test a SQL Statement to see if is executable in C#?

I am not asking to test the SQL Statement by parsing it.

I mean something similiar to execute the SQL Statement with ADO.NET, so it will actually run in SQL Server to see if the fields name correct, table names correct, stynxs correct, data type corrects etc.

The previous developer done this by executes the SQL Statement with ADO.NET and check if is throw execption. But the data return is a large data set, which is wasting the resources. So is there anyway I can ask SQL Server to perform a statement check for me in C#?

like image 828
King Chan Avatar asked Jan 18 '23 07:01

King Chan


1 Answers

Try SET PARSEONLY ON. http://msdn.microsoft.com/en-us/library/ms178629.aspx

like image 69
Jared Shaver Avatar answered Jan 19 '23 20:01

Jared Shaver