Question

I am trying to connect to a MSSQL DB using sqsh, but I can't specify the DB to use as it has a space in the name, I've tried escaping and enclosing it in square brackets/quotes etc but can't get it to work - any ideas?

Was it helpful?

Solution

According to the sqsh website, it's a client tool for Sybase, not SQL Server, so there's no guarantee that it will work, although obviously some people have had success.

Anyway, the correct delimiter in SQL Server is brackets, but I don't know if sqsh will parse that correctly on the command line: [Database Name With Spaces].

If that doesn't work but you can connect to SQL Server, then you should be able to just add USE [Database Name With Spaces] to the top of your script or type it in directly..

If you can't connect to SQL Server at all, then you should solve that problem first. You haven't given any information about your environment (client OS, SQL Server version, programming language and libraries etc.) but presumably you're on Linux so you may want to review the numerous questions on this site about connecting to SQL Server from Linux.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top