Einzelnen Beitrag anzeigen

NormanNG

Registriert seit: 1. Feb 2006
294 Beiträge
 
Delphi 2007 Professional
 
#3

Re: Erkennen welcher SQL Server verwendet wird

  Alt 14. Aug 2008, 09:19
hi,

SQL-Code:
-- DB & OS Version control START
DECLARE @VersionMaj dec(4,2), @OSVersionMaj dec(4,2)
DECLARE @VersionMin dec(4), @OSVersionMin dec(4)
CREATE TABLE #Version (IndexId int NOT NULL
                        ,Name varchar(60)
                        ,Internal_Value int
                        ,Character_Value varchar(255))
INSERT #Version exec master.dbo.xp_msver
SELECT @VersionMaj = CONVERT(dec(4,2),SUBSTRING(Character_Value,1,4))
, @VersionMin = CONVERT(dec(4),SUBSTRING(Character_Value,6,4))
FROM #Version
WHERE Name = 'ProductVersion'
SELECT @OSVersionMaj = CONVERT(dec(4,2),SUBSTRING(Character_Value,1,4))
, @OSVersionMin = CONVERT(dec(4),SUBSTRING(Character_Value,6,4))
FROM #Version
WHERE Name = 'WindowsVersion'
DROP TABLE #Version
-- DB & OS Version control END
select @VersionMaj as VersionMaj,@VersionMin as VersionMin
, @OSVersionMaj as OSVersionMaj, @OSVersionMin as OSVersionMin
das Script liefert dir u.a. die Server-Versionsnummer (VersionMaj)...
Gruß
Norman
  Mit Zitat antworten Zitat