General SQL Parser for .NET / C¶
General SQL Parser ships as a native .NET library — NuGet package gudusoft.gsqlparser — giving C# and other .NET languages the same multi-dialect SQL parsing engine as the Java edition. There is no comparable open-source option in the .NET ecosystem: libraries like Microsoft.SqlServer.TransactSql.ScriptDom cover T-SQL only, while GSP parses SQL Server, Oracle (including PL/SQL), MySQL, PostgreSQL, DB2, Snowflake, Redshift, Teradata, Hive, Impala, Informix, Netezza, Sybase, and Greenplum with one API.
Where to Start¶
- C# Quick Start — install the NuGet package, parse your first T-SQL script, check syntax errors, and extract table names
- Use cases — lineage, impact analysis, validation, auditing (concepts apply identically in .NET)
Compatibility¶
The library targets .NET Standard 2.0 and modern .NET, so it runs on:
- .NET Framework 4.6.1+
- .NET Core / .NET 5, 6, 8, 10
- Any platform .NET runs on — Windows, Linux, macOS
Relationship to the Java Documentation¶
The .NET edition is API-compatible with the Java edition by design: the class names (TGSqlParser, TSelectSqlStatement, TTable, ...), the vendor enum (EDbVendor.dbvmssql, dbvoracle, ...), and the AST structure are the same. When a how-to guide on this site shows Java, the translation to C# is usually mechanical:
| Java | C# |
|---|---|
parser.setSqltext(sql) / parser.sqltext = sql |
parser.sqltext = sql |
parser.parse() |
parser.parse() |
parser.getErrormessage() |
parser.Errormessage |
parser.getSyntaxErrors() |
parser.SyntaxErrors |
stmt.getWhereClause() |
stmt.WhereClause |
select.getResultColumnList() |
select.ResultColumnList |
stmt.getStatements() |
stmt.Statements |
Java getters generally become C# properties; list access keeps the size() / get(i) method style. The AST node reference and SQL syntax support tables apply to both editions.
Get It¶
1 | |
Then continue with the C# Quick Start.