I need help using T-SQL to figure-out the version of SQL Server running and execute different code sets based on weather SQL Server 2000 or Sql Server 2008 is running.
SELECT @@VERSION?
Or one of the SERVERPROPERTY options?
SELECT SERVERPROPERTY('productversion')
, SERVERPROPERTY ('productlevel')
, SERVERPROPERTY ('edition')
Just query the database - there is a @@VERSION
property:
SELECT @@VERSION
Returns version, processor architecture, build date, and operating system for the current installation of SQL Server.
As mentioned on the page, since all of this data is returned in one varchar, you can use the SERVERPROPERTY function to retrieve only the version:
SELECT SERVERPROPERTY('ProductVersion')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With