2

Is there a documented or at least vaguely documented way to make use of the SQL Server batchparser.dll that's hidden away deep inside the SQL Server directory structure (C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Binn)?

Would that be a possibility to submit a T-SQL batch and have it parsed for syntax errors?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 1
    Not an answer, but have you tried loading it in something like PowerShell that's easy to probe with? – JNK Jul 15 '11 at 01:54
  • http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.batchparser(v=sql.110).aspx – David Brabant Jun 19 '14 at 13:36

1 Answers1

1

Based on David Brabant's link (http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.batchparser(v=sql.110).aspx) this dll just parses the input text into batches (e.g. text between separate GO statements). The specific function to do the parsing is

http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.batchparser.batchparser.parse(v=sql.110).aspx

You might find the TSqlParser class more useful:

http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.transactsql.scriptdom.tsqlparser.aspx

or SqlParser namespace:

http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.sqlparser.parser(v=sql.120).aspx

Simon D
  • 4,150
  • 5
  • 39
  • 47