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

home | blog | Teh Internet | guest blog |rants | placeholder | political | projects | Gwen and Liam | Citadel patched | Tools | Scouts


- Careful Chrome users, this search box might be "Not secure"


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



[æ]