Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building AST from T-SQL

Is it possible to parse T-SQL in exactly the same way as done by the SQL Server?

I suppose there is some code that SQL Server uses to build an AST from the given T-SQL. Is this code available for general audience?

like image 907
mark Avatar asked Mar 17 '26 02:03

mark


1 Answers

You could use Microsoft.SqlServer.TransactSql.ScriptDom

The Microsoft.SqlServer.TransactSql.ScriptDom namespace provides Microsoft SQL Server-specific Parser and Script Generator support.

Example: A Program to Find INSERT Statements That Don’t Specify Columns

like image 122
Lukasz Szozda Avatar answered Mar 19 '26 14:03

Lukasz Szozda