How to tell what version of MS SQL Server your DB is using

home | blog | Terrible people and places | Covid-19 links | Teh Internet | guest blog |rants | placeholder | political | projects | Gwen and Liam | Citadel patched | Tools | Scouts



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



[æ]