![]() |
VOOZH | about |
dotnet add package SqlBuildingBlocks.Grammars.SQLServer --version 1.0.1
NuGet\Install-Package SqlBuildingBlocks.Grammars.SQLServer -Version 1.0.1
<PackageReference Include="SqlBuildingBlocks.Grammars.SQLServer" Version="1.0.1" />
<PackageVersion Include="SqlBuildingBlocks.Grammars.SQLServer" Version="1.0.1" />Directory.Packages.props
<PackageReference Include="SqlBuildingBlocks.Grammars.SQLServer" />Project file
paket add SqlBuildingBlocks.Grammars.SQLServer --version 1.0.1
#r "nuget: SqlBuildingBlocks.Grammars.SQLServer, 1.0.1"
#:package SqlBuildingBlocks.Grammars.SQLServer@1.0.1
#addin nuget:?package=SqlBuildingBlocks.Grammars.SQLServer&version=1.0.1Install as a Cake Addin
#tool nuget:?package=SqlBuildingBlocks.Grammars.SQLServer&version=1.0.1Install as a Cake Tool
| Component | Status |
|---|---|
| AnsiSQL grammar | Production-ready — SQL-89 + FETCH FIRST, 86+ negative tests per dialect |
| MySQL grammar | Production-ready — backticks, LIMIT/OFFSET, INTERVAL, ON DUPLICATE KEY UPDATE |
| PostgreSQL grammar | In development (stub — do not use in production) |
| SQL Server grammar | In development (stub — do not use in production) |
| Query engine | Beta — SELECT with CTEs (recursive + non-recursive), JOINs, window functions, aggregates, UNION/INTERSECT/EXCEPT, ORDER BY, GROUP BY/HAVING |
SqlBuildingBlocks is an extensible open-source library for parsing SQL into manageable, logical classes tailored to different database technologies. It is built upon Irony's SQLGrammar example and leverages the Factory and Strategy patterns for customization of SQL parsing across multiple databases.
SqlBuildingBlocks breaks down SQL into fundamental "building blocks" — NonTerminal classes, each handling a specific part of the SQL language. These NonTerminal classes use a factory pattern to create logical classes that represent SQL elements.
The QueryEngine class provides in-memory SQL execution. It accepts an ITableDataProvider (or IAllTableDataProvider for multi-table queries) and a parsed SqlSelectDefinition, and returns a VirtualDataTable of result rows.
Supported SELECT features:
SELECT *FROM table, INNER/LEFT/RIGHT/FULL OUTER JOINWHERE clause with full predicate support (comparisons, IS NULL, LIKE, IN, BETWEEN, logical operators)GROUP BY + HAVING (aggregate predicates)ORDER BY with ASC/DESC and NULLS FIRST/NULLS LASTDISTINCTCOUNT, SUM, AVG, MIN, MAX (including COUNT(DISTINCT col))ROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD, NTILE, FIRST_VALUE, LAST_VALUE, NTH_VALUE; ROWS BETWEEN frames; RANGE BETWEEN INTERVAL frames (DateTime ORDER BY)WITH (non-recursive CTE) and WITH RECURSIVE CTE; configurable depth limit via QueryEngineOptions.MaxRecursionDepth (default 100)UNION, UNION ALL, INTERSECT, EXCEPTFROM and JOIN positionsTOP NNot yet supported (throws NotSupportedException): correlated subqueries, EXISTS, ROLLUP/CUBE/GROUPING SETS, GROUP BY ROLLUP, DML execution (INSERT/UPDATE/DELETE are parse-only).
// Parse
var grammar = new AnsiSqlGrammar();
var parser = new Parser(grammar);
var parseTree = parser.Parse("SELECT * FROM Orders WHERE Amount > 100");
// Resolve
var resolver = new SelectReferenceResolver(selectDef, connectionProvider, schemaProvider, functionProvider);
resolver.ResolveTablesDatabase();
resolver.ResolveReferences();
// Execute
var engine = new QueryEngine(tableDataProvider, selectDef);
var result = engine.QueryAsDataTable();
GROUP BY ROLLUP / CUBE / GROUPING SETS executionWe're open to contributions from the community. Please refer to our for more information.
This project is licensed under the terms of the MIT license. For more information, please see the file.
Install via NuGet. All five packages publish at the same version on every merge to main.
| Package Name | Release (NuGet) |
|---|---|
SqlBuildingBlocks.Core |
👁 NuGet |
SqlBuildingBlocks.Grammars.AnsiSQL |
👁 NuGet |
SqlBuildingBlocks.Grammars.MySQL |
👁 NuGet |
SqlBuildingBlocks.Grammars.PostgreSQL |
👁 NuGet |
SqlBuildingBlocks.Grammars.SQLServer |
👁 NuGet |
For any inquiries or issues, please open a GitHub issue.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 1 NuGet packages that depend on SqlBuildingBlocks.Grammars.SQLServer:
| Package | Downloads |
|---|---|
|
ServantSoftware.Data.Common
Package Description |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.1 | 95 | 6/12/2026 |
| 1.0.0.306 | 94 | 6/12/2026 |
| 1.0.0.305 | 116 | 5/17/2026 |
| 1.0.0.303 | 98 | 5/12/2026 |
| 1.0.0.302 | 107 | 5/10/2026 |
| 1.0.0.301 | 104 | 5/10/2026 |
| 1.0.0.300 | 100 | 5/10/2026 |
| 1.0.0.299 | 103 | 5/10/2026 |
| 1.0.0.298 | 110 | 5/10/2026 |
| 1.0.0.296 | 94 | 5/10/2026 |
| 1.0.0.295 | 103 | 5/10/2026 |
| 1.0.0.294 | 106 | 5/10/2026 |
| 1.0.0.293 | 100 | 5/10/2026 |
| 1.0.0.292 | 92 | 5/10/2026 |
| 1.0.0.291 | 109 | 5/10/2026 |
| 1.0.0.290 | 99 | 5/9/2026 |
| 1.0.0.289 | 99 | 5/9/2026 |
| 1.0.0.288 | 112 | 5/9/2026 |
| 1.0.0.287 | 107 | 5/9/2026 |
| 1.0.0.286 | 190 | 5/9/2026 |