.NET SQL Parser SDK for C# and VB.NET

GSP is a commercial .NET SQL parser and semantic analysis SDK for teams that need reliable parsing, table and column extraction, offline validation, formatting, and column-level lineage across complex enterprise SQL dialects — all in-process, with no database connection.

18 runnable C# demos on GitHub — lineage, formatting, table and column extraction, SQL rewriting, syntax checking, stored procedure analysis.

Current release 4.1.0.7 (2026-07-26) · targets net10.0 and netstandard2.0

Short Answer

Use GSP .NET when your C# or VB.NET application needs more than syntax parsing: stable AST APIs exposed as idiomatic .NET properties, dialect-aware analysis, table and column extraction, offline SQL validation, a production SQL formatter, and column-level lineage that runs locally inside an enterprise environment.

Key takeaways

15 dedicated grammarsOracle, SQL Server, PostgreSQL, MySQL, DB2, Teradata, Snowflake, Redshift, Hive, Impala, and more — each a compile-time switch.
Idiomatic C# APIProperties, not Java getters: parser.Errormessage, stmt.ResultColumnList, table.FullName.
net10.0 + netstandard2.0One package serves .NET 10 and .NET Framework 4.6.2+ consumers. Builds and runs on Linux, macOS, and Windows.

Evaluate GSP .NET 4.1.0.7 locally

Every snippet below was compiled against GSP .NET 4.1.0.7 and executed — the outputs in the comments are the program's real output, not illustrations. If you cannot use a public package repository, request the trial package and restore it from a local folder.

1. Reference the package

<!-- your .csproj -->
<ItemGroup>
  <PackageReference Include="gudusoft.gsqlparser" Version="4.1.0.7" />
</ItemGroup>

4.1.0.7 is the current version on nuget.org, so dotnet add package gudusoft.gsqlparser resolves to it. This is the trial build: it parses statements up to 10,000 characters and parse() returns -1 above that — fine for individual queries, not for a real stored procedure. See below for an evaluation build without the limit. Air-gapped builds can restore the same package from an internal feed or a local folder.

2. Parse one SQL statement

using gudusoft.gsqlparser;

string sql = @"select c.customer_id, sum(o.amount) total
               from customers c join orders o on c.id = o.customer_id
               group by c.customer_id";

TGSqlParser parser = new TGSqlParser(EDbVendor.dbvoracle);
parser.sqltext = sql;
int result = parser.parse();

3. Handle parser errors clearly

if (result != 0)
{
    Console.WriteLine(parser.Errormessage);
    // e.g. syntax error, state:90(10101) near: from(1,8)
    return;
}

Errors carry the offending token with line and column position, so you can point a user straight at the problem.

4. Inspect AST, tables, and columns

using gudusoft.gsqlparser.nodes;

for (int i = 0; i < parser.sqlstatements.size(); i++)
{
    TCustomSqlStatement stmt = parser.sqlstatements.get(i);
    Console.WriteLine(stmt.sqlstatementtype);            // sstselect

    for (int t = 0; t < stmt.tables.size(); t++)
    {
        TTable table = stmt.tables.getTable(t);
        Console.WriteLine(table.FullName + " " + table.AliasName);
        // customers c
        // orders o
    }

    for (int c = 0; c < stmt.ResultColumnList.size(); c++)
    {
        TResultColumn rc = stmt.ResultColumnList.getResultColumn(c);
        Console.WriteLine(rc.Expr + (rc.AliasClause != null ? " AS " + rc.AliasClause : ""));
        // c.customer_id
        // sum(o.amount) AS total
    }
}

What your .NET product can build on

ASTStatement type, clauses, expressions, joins, predicates, functions, and nested query structure.
Tables and columnsSource tables, result columns, aliases, scopes, and references for downstream tooling.
ValidationParser and semantic error signals for invalid SQL, unsupported syntax, or catalog-aware checks.
LineageTable and column dependency signals for impact analysis and governance workflows.

Format SQL from the same parse tree

The formatter is part of the library, not a separate product — it renders the AST you already parsed, so it never reflows SQL it did not understand.

C#

using gudusoft.gsqlparser.pp.para;
using gudusoft.gsqlparser.pp.stmtformatter;

TGSqlParser parser = new TGSqlParser(EDbVendor.dbvmssql);
parser.sqltext = "select a.id,b.name from t1 a inner join t2 b on a.id=b.id "
               + "where a.status='X' order by 1";
if (parser.parse() != 0) { Console.Error.WriteLine(parser.Errormessage); return; }

GFmtOpt option = GFmtOptFactory.newInstance();
Console.WriteLine(FormatterFactory.pp(parser, option));

Output

SELECT   a.id,
         b.NAME
FROM     t1 a
         INNER JOIN t2 b
         ON a.id = b.id
WHERE    a.status = 'X'
ORDER BY 1

Trace a column back through views and aggregates

The dataFlowAnalyzer demo ships as C# source with the SDK. Below is its real output for a CREATE VIEW over a two-table join with a SUM() — note that TOTAL_AMOUNT is resolved to ORDERS.AMOUNT through the aggregate, and the join keys are recorded separately as a dataflow_recordset relation.

<dlineage>
  <table id="1" name="CUSTOMERS" type="table" alias="C">
    <column id="2" name="CUSTOMER_ID" />
    <column id="1" name="ID" />
  </table>
  <table id="2" name="ORDERS" type="table" alias="O">
    <column id="5" name="AMOUNT" />
  </table>
  <view id="4" name="V_CUSTOMER_TOTAL" type="view">
    <column id="9" name="TOTAL_AMOUNT" />
  </view>
  <relation type="dataflow" id="2">
    <target id="7" column="TOTAL_AMOUNT" parent_name="RESULT_OF_SELECT-QUERY" />
    <source id="5" column="AMOUNT"       parent_name="ORDERS" />
  </relation>
  <relation type="dataflow_recordset" id="5">
    <target id="7" column="TOTAL_AMOUNT" parent_name="RESULT_OF_SELECT-QUERY" function="SUM" />
    <source id="1" column="ID"           parent_name="CUSTOMERS" />
  </relation>
</dlineage>

Same engine behind Gudu SQLFlow and the lineage integrations for DataHub and OpenMetadata.

One package, old and new .NET

net10.0.NET 10 (LTS) — the recommended target for new C# and VB.NET projects.
netstandard2.0.NET Framework 4.6.2+, and any other .NET Standard 2.0 consumer. Nothing to recompile for legacy WinForms/WPF/ASP.NET hosts.

Looking for the JVM instead? See the Java SQL Parser SDK. The two editions share the same grammar lineage and AST model, with .NET exposing it through properties.

Questions .NET evaluators actually ask

Does the .NET edition use Java-style getters?

No. GSP .NET exposes idiomatic C# properties: parser.Errormessage, stmt.ResultColumnList, table.FullName, table.AliasName. If you are porting code or examples written against the Java edition, getFromClause() becomes .FromClause and getAliasName() becomes .AliasName — the Java method forms do not exist in the .NET assembly.

Which SQL dialects does the .NET edition support?

15 dedicated grammars: Oracle, SQL Server (T-SQL), MySQL, PostgreSQL, IBM Db2, Sybase, IBM Informix, Snowflake, Amazon Redshift, Teradata, Greenplum, IBM Netezza, Apache Hive, Apache Impala, MDX. ANSI, generic, ODBC, Access, and Firebird are handled by the shared core grammar. BigQuery, SAP HANA, and DAX are available in the Java edition only — constructing a .NET parser for those vendors throws NotSupportedException rather than silently mis-parsing.

Can I ship a build with only the databases I license?

Yes. Each dialect is a compile-time switch (/p:includeOracle=true, /p:includeMssql=true, and so on), so a per-customer build carries only the grammar tables you paid for and nothing else. This keeps the shipped assembly small and the licensed surface explicit.

Does validating SQL require a database connection?

No. Parsing, validation, formatting, and lineage all run entirely in-process with no server, driver, or credentials. This is what makes GSP usable inside air-gapped and regulated environments.

Is the .NET edition on nuget.org?

Yes, and it is current. gudusoft.gsqlparser 4.1.0.7 (released 2026-07-26) is the latest version on nuget.org, so dotnet add package gudusoft.gsqlparser gets you the same build Gudu ships. If your build environment has no route to a public feed, Gudu supplies the identical package with your evaluation or licence and you can restore it from an internal feed or a local package folder.

Past 10,000 characters?

The nuget package is free and needs no request — but it stops at 10,000 characters per statement. Real stored procedures, migration scripts and generated queries run well past that, so ask for an evaluation build without the limit; Gudu can recommend the right API path at the same time. The playground takes statements up to 65,000 characters, so you can watch GSP handle one of yours first.