Deep IBM Db2 SQL syntax highlighting for Visual Studio Code.
Designed for developers who work with .db2 scripts and need DB2-aware highlighting instead of generic SQL or MSSQL highlighting.
.db2files are recognized as DB2 SQL.- DB2 SQL keywords, clauses and operators.
- DB2 data types and storage modifiers.
- Built-in functions: aggregate, window, string, numeric, date/time, conversion, XML and JSON.
- Common DB2 special registers such as
CURRENT_DATE,CURRENT_SCHEMA,CURRENT_USERandCURRENT_TIMESTAMP. - Transaction isolation syntax:
WITH UR,WITH CS,WITH RS,WITH RR. - CTE and recursive SQL support.
- Window functions and frame clauses.
- MERGE, cursor and dynamic SQL syntax.
- SQL PL constructs including procedures, handlers,
SIGNAL,RESIGNALandGET DIAGNOSTICS. - Declared global temporary tables.
- Temporal tables and system/business time syntax.
- Quoted identifiers, parameters, numeric literals and DB2 variables.
- Snippets for common DB2 development patterns.
Package the extension locally:
npm install
npm run packageThen install the generated .vsix using Extensions: Install from VSIX... or:
code --install-extension vscode-db2-0.2.0.vsixAfter publication, search for DB2 SQL by publisher nguyenngocbinh in the VS Code Extensions view.
| Prefix | Purpose |
|---|---|
db2select |
SELECT with WITH UR |
db2cte |
Common table expression |
db2merge |
MERGE statement |
db2proc |
SQL procedure skeleton |
db2cursor |
Cursor declaration/lifecycle |
db2handler |
SQL exception handler |
db2signal |
SIGNAL SQLSTATE |
db2temp |
Declared global temporary table |
db2window |
Window function |
db2temporal |
Temporal query |
WITH ACTIVE_CUSTOMERS AS (
SELECT CUSTOMER_ID,
CURRENT_DATE AS RUN_DATE,
ROW_NUMBER() OVER (
PARTITION BY SEGMENT
ORDER BY CUSTOMER_ID
) AS RN
FROM CUSTOMER
WHERE STATUS = 'ACTIVE'
)
SELECT *
FROM ACTIVE_CUSTOMERS
FETCH FIRST 100 ROWS ONLY
WITH UR;Install the local packaging dependency:
npm installPackage:
npm run packageValidate the extension manifest without packaging:
npx vsce lsPublish manually after configuring your Marketplace publisher and VSCE_PAT:
npm run publishThe repository includes a GitHub Actions workflow that packages the extension on pushes and pull requests. A tag matching v* triggers the publish job.
Create a repository secret named VSCE_PAT, then publish a release by pushing a version tag, for example:
git tag v0.2.0
git push origin v0.2.0The workflow uses the VSCE_PAT secret only during the Marketplace publish step.
This extension currently focuses on syntax highlighting and snippets. It does not execute SQL, connect to a Db2 server, provide query results, or replace a DB2 database client.
MIT