Skip to content

Instantly share code, notes, and snippets.

@brazilnut2000
Last active June 20, 2019 00:01
Show Gist options
  • Save brazilnut2000/5260446 to your computer and use it in GitHub Desktop.
Save brazilnut2000/5260446 to your computer and use it in GitHub Desktop.
SQL: Detect SQL Server Version
SELECT
CASE @@microsoftversion/ 0x01000000
WHEN 6 THEN 'You''ve got to be kidding me.'
WHEN 7 THEN 'SQL Server 7.0'
WHEN 8 THEN 'SQL Server 2000'
WHEN 9 THEN 'SQL Server 2005'
WHEN 10 THEN 'SQL Server 2008'
WHEN 11 THEN 'SQL Server 2012'
WHEN 12 THEN 'Time to update your gist, homey.'
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment