Skip to content

General SQL Parser .NET Documentation

Welcome to the documentation for General SQL Parser .NET (GSP) — a powerful C# / .NET library for parsing, analysing and rewriting SQL from 15 different database systems including Oracle, SQL Server, DB2, PostgreSQL, MySQL, Snowflake, Teradata, and more.

What is General SQL Parser?

General SQL Parser is a self-contained .NET library that lets you:

  • Parse SQL statements written in any of the supported dialects
  • Analyse the resulting Abstract Syntax Tree (AST) — tables, columns, joins, expressions
  • Rewrite SQL programmatically and emit it back to text
  • Validate SQL syntax across vendors without ever connecting to a database
  • Extract metadata, dependencies and column-level lineage

Key features

Multi-database support

15 dialects out of the box: DB2, Greenplum, Hive, Impala, Informix, MDX, MSSQL (T-SQL), MySQL, Netezza, Oracle, PostgreSQL, Redshift, Snowflake, Sybase, Teradata. The MSSQL dialect also covers Microsoft Access (EDbVendor.dbvaccess is an alias).

Cross-platform .NET

The library multi-targets net10.0 and netstandard2.0. That means it runs on:

  • .NET 10 (the recommended target — LTS, supported through 2028-11)
  • .NET Framework 4.6.1+ (via the netstandard2.0 facade)
  • Anything else that consumes netstandard2.0 (Mono, Unity, Xamarin)

Self-contained

Zero third-party dependencies. No database connection required for parsing — all 15 grammar tables are embedded as resources in the assembly.

Rich AST + visitor pattern

Every SQL element gets a strongly-typed node class (TSelectSqlStatement, TExpression, TTable, TFunctionCall, ...). Walk the tree with the built-in IExpressionVisitor or modify it in place and re-emit SQL via TScriptGenerator.

Quick start

1
dotnet add package gudusoft.gsqlparser
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
using gudusoft.gsqlparser;

var sqlparser = new TGSqlParser(EDbVendor.dbvoracle);
sqlparser.sqltext = "SELECT * FROM employees WHERE salary > 50000";

int result = sqlparser.parse();
if (result == 0)
{
    Console.WriteLine($"Parsed {sqlparser.sqlstatements.size()} statement(s)");
}
else
{
    Console.WriteLine(sqlparser.Errormessage);
}

Get Started ->

Documentation structure

This documentation follows the Diátaxis framework:

Learning-oriented guides that walk you through GSP step by step.

Information-oriented documentation — APIs, syntax tables, configuration.

Use cases

GSP .NET is used in production for:

  • Data migration — translate SQL between dialects
  • Validation — pre-flight syntax checks before sending queries to a database
  • Code analysis — quality, dependencies, impact
  • Query rewriting — programmatic transformations on the AST
  • Schema documentation — extract metadata from DDL scripts
  • ETL tooling — parse and inspect SQL embedded in pipelines

Explore Use Cases ->

Community & support

License

General SQL Parser is available under both commercial and trial licenses. See the licensing FAQ for details.


Ready to start parsing SQL? Get Started ->