osql -E -S".\DBINSTANCENAME" -q"SELECT @@VERSION" For just testing on the local instance (i.e. without the db): osql -E -q"SELECT @@VERSION" To get the database names, this can help: osql -E -Q"SELECT name,filename FROM SYSDATABASES" For a non socket connection give this a spin: osql -E -S lpc:computer\sqlinstancename -Q"SELECT name,filename FROM SYSDATABASES" Backup one of the db's: osql -E -S lpc:computer\sqlinstancename -Q "BACKUP DATABASE dbname TO DISK='C:\dumplocation\dbname.bak' WITH FORMAT"
This might help some as well:
ALTER DATABASE Northwind SET AUTO_CLOSE OFF