gudusoft.gsqlparser 4.1.0.18

dotnet add package gudusoft.gsqlparser --version 4.1.0.18
                    
NuGet\Install-Package gudusoft.gsqlparser -Version 4.1.0.18
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="gudusoft.gsqlparser" Version="4.1.0.18" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="gudusoft.gsqlparser" Version="4.1.0.18" />
                    
Directory.Packages.props
<PackageReference Include="gudusoft.gsqlparser" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add gudusoft.gsqlparser --version 4.1.0.18
                    
#r "nuget: gudusoft.gsqlparser, 4.1.0.18"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package gudusoft.gsqlparser@4.1.0.18
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=gudusoft.gsqlparser&version=4.1.0.18
                    
Install as a Cake Addin
#tool nuget:?package=gudusoft.gsqlparser&version=4.1.0.18
                    
Install as a Cake Tool

Trial edition. This package refuses SQL longer than 10,000 characters: parse() returns -1 and Errormessage reads "trial version can only process query with size less than 10000 characters". That is the trial limit, not a parse error in your SQL. Everything else behaves exactly as the full edition, which is available from https://www.sqlparser.com.

General SQL Parser .NET

Parse, analyze, modify and format SQL from 15 database vendors, in process, with no database connection.

Given a query, you get a parse tree you can walk: statement types, tables, columns, expressions, joins, CTEs, subqueries. You can rewrite the tree and generate SQL back out, or run the formatter over it.

SQL Server data lineage uses the default DataFlowAnalyzer, Option, generateDataFlow() and model API. The compiled example shows file input, XML output and diagnostic handling. Check diagnostics before treating a result as complete. The release scope and known limitations describe the validated scenarios and remaining syntax limitations.

The source development version also provides opt-in IdentifierServices for Oracle, PostgreSQL, Snowflake and MSSQL. See the compiled binding example and Chinese API contract for typed identities, explicit input forms and supported boundaries.

Install

dotnet add package gudusoft.gsqlparser

Quick start

using gudusoft.gsqlparser;
using gudusoft.gsqlparser.nodes;
using gudusoft.gsqlparser.stmt;

var parser = new TGSqlParser(EDbVendor.dbvoracle);
parser.sqltext = "SELECT dept_id, COUNT(*) AS headcount "
               + "FROM employees e JOIN departments d ON e.dept_id = d.id "
               + "WHERE e.salary > 50000 GROUP BY dept_id";

if (parser.parse() != 0)
{
    Console.WriteLine(parser.Errormessage);
    return;
}

var select = (TSelectSqlStatement)parser.sqlstatements.get(0);
Console.WriteLine($"statement type: {select.sqlstatementtype}");

foreach (TTable table in select.tables)
    Console.WriteLine($"table:  {table.FullName}");

for (int i = 0; i < select.ResultColumnList.size(); i++)
    Console.WriteLine($"column: {select.ResultColumnList.getResultColumn(i).Expr}");

Output:

statement type: sstselect
table:  employees
table:  departments
column: dept_id
column: COUNT(*)

parse() returns 0 on success. On failure it returns non-zero and Errormessage explains why.

Supported databases

Pass the matching EDbVendor to the constructor:

Database EDbVendor Database EDbVendor
Oracle dbvoracle Snowflake dbvsnowflake
SQL Server dbvmssql Teradata dbvteradata
PostgreSQL dbvpostgresql Greenplum dbvgreenplum
MySQL dbvmysql Redshift dbvredshift
DB2 dbvdb2 Netezza dbvnetezza
Hive dbvhive Informix dbvinformix
Impala dbvimpala Sybase dbvsybase
MDX dbvmdx

Target frameworks

net10.0 and netstandard2.0. The netstandard2.0 build covers .NET Framework 4.6.2+, Mono and Unity. (4.6.2, not 4.6.1: the netstandard2.0 build depends on System.Text.Json 8.0.5, whose lowest .NET Framework asset is net462.)

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.1.0.18 139 10/21/2026
4.1.0.16 662 9/29/2026
4.1.0.15 162 9/25/2026
4.1.0.14 611 8/27/2026
4.1.0.13 389 8/8/2026
4.1.0.12 126 8/8/2026
4.1.0.11 125 8/8/2026
4.1.0.10 136 8/8/2026
4.1.0.9 137 8/7/2026
4.1.0.8 228 7/30/2026
4.1.0.7 233 7/26/2026
4.1.0.6 141 7/25/2026
3.3.0.4 160,595 9/3/2019
3.3.0.2 21,118 4/17/2019
3.3.0.1 2,299 4/16/2019
3.2.6.5 3,593 9/5/2018
3.2.6.3 2,509 9/4/2018
3.2.6 6,447 9/4/2018

TRIAL EDITION - SQL longer than 10,000 characters is rejected (parse() returns -1). Full edition: https://www.sqlparser.com/

Release 4.1.0.18

- [MSSQL] Complete lineage for the 41 SQL Server inputs that 4.1.0.17
 listed as deferred; they no longer report SyntaxError.
- [MSSQL] Accept CREATE COLUMN MASTER KEY, COLUMN ENCRYPTION KEY,
 DATABASE ENCRYPTION KEY, EVENT SESSION, EXTERNAL LANGUAGE and
 EVENT NOTIFICATION, security policy predicates and extended GRANT.
- [MSSQL] Accept FORCE DISTRIBUTED PLAN and FOR TIMESTAMP AS OF hints,
 ALTER COLUMN ADD/DROP HIDDEN, PERSISTED and NOT FOR REPLICATION,
 index REBUILD and columnstore ORDER variants, and --1 in expressions.
- [MSSQL] Split view bodies and DDL continuations into statements the
 same way with and without lineage analysis.
- [MSSQL] Release lineage request metadata from a pooled worker after
 a spill IO failure. Fix Boolean and repeated-element XML decoding.
- [PostgreSQL] Parse PREPARE into TPrepareStmt (Mantis 4868).
- [PostgreSQL] Support INSERT ... ON CONFLICT, TABLE t queries, a CTE
 body that starts with WITH, and keyword-qualified type names.

Demos: https://github.com/sqlparser/gsp_demo_dotnet