More for me than for you. I’ve written and re-written this about 6 times this week and can’t seem to remember to save it off, so here I go. This will return the major version number for the sql server being queried. Sql Server 2000 = 8, Sql Server 2005 = 9, etc…
SELECT LEFT(CONVERT(SYSNAME,SERVERPROPERTY('ProductVersion')), CHARINDEX('.', CONVERT(SYSNAME,SERVERPROPERTY('ProductVersion')), 0)-1)