Having a database name (MSSQL) containing a hyphen causes various issues with queries generated by SQuirreL SQL itself, such as Objects->Content or Object ->Columns when looking at a DB table in such a database.
2026-06-22 15:45:17:019 [pool-1-thread-1] ERROR net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.tabs.BaseDataSetTab - <messageIsNull>
com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '-'.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:265)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1673)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:907)
at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:802)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7627)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:3912)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:268)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:242)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeQuery(SQLServerStatement.java:724)
at net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.tabs.table.RowCountTab.createDataSet(RowCountTab.java:75)
at net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.tabs.BaseDataSetTab.lambda$refreshComponent$0(BaseDataSetTab.java:134)
at net.sourceforge.squirrel_sql.fw.util.TaskExecuter.run(TaskExecuter.java:82)
at java.base/java.lang.Thread.run(Thread.java:840)
Like:
> select * from test-database.dbo.table;
causes
Error: Incorrect syntax near '-'.
SQLState: S0001
ErrorCode: 102
If the table name is quoted ("" or []) the query does succeed:
> select * from [test-database].dbo.table;
or
> select * from "test-database".dbo.table;
SQuirreL SQL Client Version 5.1.0
using mssql-jdbc-11.2.1.jre17.jar
Microsoft SQL Server 2019