SAP SQL Anywhere SQL Parser for Java
General SQL Parser (GSP) parses SAP SQL Anywhere with a dedicated SQL Anywhere (Watcom-SQL) grammar, separate from the permissive Sybase vendor that spans the whole family — full AST access, offline syntax validation, formatting, rewriting, and column-level data lineage, including complete procedural SQL support. One commercial SDK — SAP SQL Anywhere is available in the Java edition.
SAP SQL Anywhere SQL that GSP parses
CREATE PROCEDURE update_dept_count(IN dept INT)
BEGIN
UPDATE dept SET cnt = (SELECT COUNT(*) FROM emp WHERE emp.dept_id = dept)
WHERE dept.id = dept;
END Parse it in Java
import gudusoft.gsqlparser.*;
TGSqlParser parser = new TGSqlParser(EDbVendor.dbvsqlanywhere);
parser.sqltext = sql; // the SAP SQL Anywhere SQL above
if (parser.parse() == 0) {
System.out.println(parser.sqlstatements.size() + " statement(s) parsed");
} else {
System.out.println(parser.getErrormessage());
} Java edition only. The .NET library has no SAP SQL Anywhere grammar, so this dialect cannot be parsed from C# or VB.NET. See the .NET SQL Parser SDK for the dialects it does cover.
What GSP handles in SAP SQL Anywhere
- LOAD TABLE bulk loading and UNLOAD-style OUTPUT
- Embedded SQL: ALLOCATE / GET / SET DESCRIPTOR, PREPARE, PUT
- CREATE EXISTING TABLE and FORWARD TO remote servers
- CREATE SERVICE web services and CREATE LOGIN POLICY
- Engine control: START/STOP DATABASE, START/STOP ENGINE, INSTALL JAVA
- Procedural SQL: Watcom-SQL and T-SQL procedure, function, and event definitions, with CALL, cursor blocks, and SIGNAL/RESIGNAL handlers
Beyond parsing, the same AST powers table/column extraction, validation, formatting, and column-level lineage for SAP SQL Anywhere.
Recent SAP SQL Anywhere parser updates
- 2026-08-17 [SAP SQL Anywhere] Dedicated vendor with its own grammar, statement splitter, and syntax coverage page
- 2026-08-17 [SAP SQL Anywhere] Reject Sybase IQ specialized index types and IQ-only DDL
- 2026-08-17 [SAP SQL Anywhere] Reject ASE-only statements such as DUMP TRANSACTION and READTEXT, naming the product each belongs to
Full history in the release notes.
SAP SQL Anywhere resources
- SAP SQL Anywhere syntax reference — dialect documentation
- SAP SQL Anywhere capability data (JSON) — measured construct-by-construct parse coverage, machine-readable
- Java quick start — Maven/Gradle setup and first parse
Common questions
Does GSP parse SAP SQL Anywhere stored procedures and procedural SQL?
Yes. GSP parses Watcom-SQL and T-SQL procedure, function, and event definitions, with CALL, cursor blocks, and SIGNAL/RESIGNAL handlers into a full AST — procedure bodies become real statement trees you can traverse, not opaque text blocks. This is what makes lineage and impact analysis work inside procedural code.
Do I need a live SAP SQL Anywhere database connection to validate SQL?
No. GSP validates SAP SQL Anywhere syntax completely offline. You get error line and column positions, the offending token, and a hint — with no server, driver, or credentials involved.
Can I use the SAP SQL Anywhere parser from C# / .NET?
Not currently. SAP SQL Anywhere is a Java-edition dialect — the .NET library ships 15 dedicated grammars and SAP SQL Anywhere is not one of them, so there is no C# code path for it. Everything else on this page describes the Java SDK. If you need SAP SQL Anywhere in .NET, email info@sqlparser.com; customer demand is how dialects get prioritized for the .NET port.
Can GSP extract column-level lineage from SAP SQL Anywhere SQL?
Yes. The built-in DataFlowAnalyzer produces column-level lineage, impact analysis, and call graphs from SAP SQL Anywhere scripts — it is the engine behind Gudu SQLFlow and the lineage integrations for DataHub and OpenMetadata.