Wednesday, February 15, 2012

Execute check sql syntax programatically

HI, Is there a way to check sql syntax from a .Net application? Sql server management studio is made in .Net and it has that option. Is teher a way to know how it is implemented in SSMS?

Thank you,
Ccote

Hi Ccote,

SSMS performs some farly rudimentary syntax checks, but not a complete TSQL syntax validation. This is done via TSQL command

SET PARSEONLY ON

This functionality is also exposed in SMO via ParseOnly option:

Code Snippet

Server.ConnectionContext.ExecuteNonQuery(myquery, ExecutionTypes.NoCommands);

|||HI, Thank you for your answer!|||Not being very familiar with VB.Net, how would I caputure the output of the ParseOnly result into a variable?

No comments:

Post a Comment