A minimal Sisula-like templating engine running inside SQL Server using SQLCLR.
For the full language reference and examples see SISULA.md in this repository. The language reference documents tokens, directives (foreach/if), loop metadata method calls, expression syntax, and JSON resolution behavior.
Quick start
-
Build DLL
- Open PowerShell in
mssql-sisula/scriptsand run:./build.ps1
- Open PowerShell in
-
DBA prerequisites and trust
- Ensure CLR is enabled on the instance:
EXEC sp_configure 'clr enabled', 1; RECONFIGURE; - Keep
clr strict securityenabled (recommended). Use a trusted/signing approach instead of disabling it. - To trust this build when
clr strict securityis ON, compute the SHA-512 and register it viasys.sp_add_trusted_assemblyon the server (sysadmin required).
- Ensure CLR is enabled on the instance:
-
Install into your database (recommended)
- PowerShell (Windows auth):
pwsh -File scripts/install.ps1 -Server "YOURSERVER" -Database "YourTestDb" - Add
-RegisterTrustedAssemblyto register the SHA-512 in master when strict security is ON. - Optional: install templates into the DB for easy reuse: add
-InstallTemplates. Templates are read fromtemplates/*.sql.
- PowerShell (Windows auth):
-
Render the sample
- Run
sql/test_render.sqland inspect therenderedoutput.
- Run
Notes
- Uses SQL Server JSON functions (JSON_VALUE/JSON_QUERY/OPENJSON); no third-party JSON libraries required. Scalar tokens are limited to NVARCHAR(4000).
If you're using an AI coding assistant, start here:
- See
.github/copilot-instructions.mdfor a compact project brief and useful prompts.