Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dbo.usp_getSQLServerVersion.sql for RDS #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions source/common/stored-procedures/dbo.usp_getSQLServerVersion.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ GO

CREATE PROCEDURE [dbo].[usp_getSQLServerVersion]
@sqlServerName [sysname],
@serverHostedType [varchar](50) OUT,
@serverEdition [sysname] OUT,
@serverVersionStr [sysname] OUT,
@serverVersionNum [numeric](9,6) OUT,
Expand Down Expand Up @@ -51,7 +52,8 @@ END CATCH
IF @serverEdition IS NULL
begin
SET @queryToRun = N''
SET @queryToRun = @queryToRun + 'SELECT CAST(SERVERPROPERTY(''Edition'') AS [sysname]) AS [edition],
SET @queryToRun = @queryToRun + 'SELECT IIF( DB_ID(''rdsadmin'') IS NOT NULL, ''AWS RDS'', ''Windows Hosted'') AS [HostedType],
CAST(SERVERPROPERTY(''Edition'') AS [sysname]) AS [edition],
CAST(SERVERPROPERTY(''ProductVersion'') AS [sysname]) AS [product_version],
CAST(SERVERPROPERTY(''EngineEdition'') AS [int]) AS [engine]'
SET @queryToRun = [dbo].[ufn_formatSQLQueryForLinkedServer](@sqlServerName, @queryToRun)
Expand All @@ -61,14 +63,16 @@ IF @serverEdition IS NULL
CREATE TABLE #serverProperty
(
[edition] [sysname]
, [HostedType] [varchar](50)
, [product_version] [sysname]
, [engine] [int]
)

INSERT INTO #serverProperty([edition], [product_version], [engine])
INSERT INTO #serverProperty([HostedType], [edition], [product_version], [engine])
EXEC sp_executesql @queryToRun

SELECT @serverEdition = [edition]
SELECT @serverHostedType = [HostedType]
, @serverEdition = [edition]
, @serverVersionStr = [product_version]
, @serverEngine = [engine]
FROM #serverProperty
Expand Down