sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

Add Microsoft SQL Server support

Open SockworkOrange opened this issue 11 months ago • 7 comments

What do you want to change?

I am one of the developers of the C# plugin. We published our plugin in the community and received a lot of feedback - mainly around the lack of support in SQL Server. I took a look at the engines implementations and saw that in SQLite you use antlr to parse the SQL, and that antlr has the same kind of support for tsql (SQL Server's SQL dialect).

I want to propose that I will start working on an SQL Server iplementation, in the same manner as the SQLite one. @doron050

What database engines need to be changed?

No response

What programming language backends need to be changed?

No response

SockworkOrange avatar Jan 06 '25 18:01 SockworkOrange

I updated the title and added the tag we use for all new engine requests. This one is unlikely to happen soon, mainly because I have larger plans for refactoring how we add new engines. That said it's most certainly on the roadmap.

kyleconroy avatar Jan 09 '25 19:01 kyleconroy

What would be necessary to get some traction here? I'm doing a hard push on my org to move to more modern tooling and sqlc not being in sql server is one of the biggest detractors for a mainly microsoft shop.

twolfvb avatar Nov 26 '25 19:11 twolfvb

If it's possible, @SockworkOrange and I are willing to give it a try 🙏

doron050 avatar Nov 28 '25 14:11 doron050

@kyleconroy given that there's 2 people willing to commit their time to this, can anything about the refactor be sped up? Maybe outlining the interfaces that will be used, or have them just go ahead with it right now and deal with the refactor later?

twolfvb avatar Nov 28 '25 18:11 twolfvb

@kyleconroy any inputs here?

twolfvb avatar Dec 10 '25 14:12 twolfvb

I posted a 2026 roadmap a few days ago. While this didn't make it, the Go API should make it much easier to support SQL Server.

@twolfvb the help I need is on the research side. For SQL server support, I need to find a Go parser for T-SQL (that doesn't depend on cgo) and to document the process for extracting column and parameter information from a query using a running SQL Server.

kyleconroy avatar Dec 10 '25 18:12 kyleconroy

@kyleconroy Confirming the first part regarding a GO parser for T-SQL, does using the same antlr4-grammers codegen tool done for SQLite work? Because as far as we can tell, there is no CGO dependency in that tool.

Regarding the documentation - I am famiiar with how to do that, ex-DBA and all. That part we can definitely take

SockworkOrange avatar Dec 10 '25 20:12 SockworkOrange