TSqlParser 0.1.0
See the version list below for details.
dotnet add package TSqlParser --version 0.1.0
NuGet\Install-Package TSqlParser -Version 0.1.0
<PackageReference Include="TSqlParser" Version="0.1.0" />
paket add TSqlParser --version 0.1.0
#r "nuget: TSqlParser, 0.1.0"
// Install TSqlParser as a Cake Addin
#addin nuget:?package=TSqlParser&version=0.1.0
// Install TSqlParser as a Cake Tool
#tool nuget:?package=TSqlParser&version=0.1.0
TSqlParser
Why another parser ?
The goal of this project is to be able analyze T-Sql statements (similar to sp_depends someprocedurename) to get a list of tables touched with the operation type (UPDATE, INSERT, SELECT or DELETE) without having a connection to the database. If you have connection to the database, then definitely first review if sp_depends satisfies your requirements.
How is this different ?
sp_depends does not distinguish between updates and inserts and does not report on data being deleted from tables.
Cool, how can I use it ?
Reference TSqlParser.Core.dll and init SqlScriptAnalyzer. The ParserResults object has the collection of tables and stored procedures invoked.
string _sqlText = "INSERT INTO table1
SELECT a, b, c
FROM table2
EXEC pr_some_inner_procedure ";
SqlScriptAnalyzer _analyzer = new SqlScriptAnalyzer();
ParserResults actual = await _analyzer.AnalyzeSqlTextAsync(_sqlText);
Console.WriteLine(actual.ToString());
Parsing Result
- Tables touched
- table1 - INSERT
- table2 - SELECT
- Procedures Invoked
- pr_some_inner_procedure
code on github @ https://github.com/console-writeline/t-sql-parser nuget package @ https://www.nuget.org/packages/TSqlParser
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net47 is compatible. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
.NETFramework 4.7
- Microsoft.SqlServer.TransactSql.ScriptDom (>= 14.0.3811.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.