I\'d like if its possible to work out from inside sql server how long sql server has been running.
Would like to use this in conjunction with one of the DMV\'s for unuse
This simple query works for versions before SQL Server 2005 as well as recent ones:
SELECT crdate AS startup, DATEDIFF(s, crdate, GETDATE()) / 3600. / 24 AS uptime_days FROM master..sysdatabases WHERE name = 'tempdb'