May 16, 2012

sp_MSgetversion (Transact-SQL MetaData) Definition

Please note: that the following source code is provided and copyrighted by Microsoft and is for educational purpose only.
The meta data is from an SQL 2012 Server.

I have posted alot more, find the whole list here.

Goto Definition or MetaData

Definition:

sys.sp_MSgetversion()

MetaData:

 --   
-- Name:
-- sp_MSgetversion
--
-- Description:
-- Get the server product version, license type and package type.
-- This procedure is for downlevel compatibility since pre-SQL11 subscribers depend on it.
--
-- Returns:
-- 0-Success
--
-- Security:
-- Internal

CREATE PROCEDURE sys.sp_MSgetversion
AS
BEGIN
--
* Dev Note (VSTS#749780):
* sp_MSgetversion was removed in Denali since it was an internal sp and deprecated.
* We re-implement it in repl for downlevel compatibility.
* Repl agents in Denali do not use it.
*
* The package type is not available directly in serverproperty.
* We do some simple translation from engineedition.The values are,
* PACKAGE_STANDARD = 2 ;
* PACKAGE_ENTERPRISE = 3 ;
* PACKAGE_MSDE = 4 ;
* PACKAGE_EXPRESS = 5 ;
* ENGINE_MSDE = 1 ;
* ENGINE_STANDARD = 2 ;
* ENGINE_ENTERPRISE = 3 ;
* ENGINE_EXPRESS = 4 ;
* In fact nobody cares about the package type, we just make it complete.
--
SELECT SERVERPROPERTY('ProductVersion'),
CASE SERVERPROPERTY('LicenseType')
WHEN 'PER_SEAT' THEN 1
WHEN 'PER_PROCESSOR' THEN 2
-- Just keep same behavior as the old sp, return 1 for other cases
-- Keep the PER_SEAT case to indicate the licensetype
ELSE 1
END,
CASE SERVERPROPERTY('EngineEdition')
WHEN 1 THEN 4
WHEN 4 THEN 5
ELSE SERVERPROPERTY('EngineEdition')
END
RETURN 0
END

No comments:

Post a Comment

Total Pageviews