Technical Conventions

@RunnableUnder Parsing

Every proc that accepts @RunnableUnder uses the same parsing pattern:

DECLARE @ThresholdStd DECIMAL(10,2) = NULL;
DECLARE @ThresholdEnt DECIMAL(10,2) = NULL;
DECLARE @ActiveThreshold DECIMAL(10,2) = NULL;

IF @RunnableUnder IS NOT NULL AND LTRIM(RTRIM(@RunnableUnder)) <> ''
BEGIN
    IF @RunnableUnder LIKE '%,%e'
    BEGIN
        SET @ThresholdStd = TRY_CAST(LEFT(@RunnableUnder, CHARINDEX(',', @RunnableUnder) - 1) AS DECIMAL(10,2));
        SET @ThresholdEnt = TRY_CAST(SUBSTRING(@RunnableUnder, CHARINDEX(',', @RunnableUnder) + 1,
            LEN(@RunnableUnder) - CHARINDEX(',', @RunnableUnder) - 1) AS DECIMAL(10,2));
    END
    ELSE
    BEGIN
        SET @ThresholdStd = TRY_CAST(@RunnableUnder AS DECIMAL(10,2));
        SET @ThresholdEnt = @ThresholdStd;
    END
END

SET @ActiveThreshold = CASE WHEN @IsEnterprise = 1 THEN @ThresholdEnt ELSE @ThresholdStd END;

@LinkedServer Post-Processing

When @LinkedServer = 1, the orchestrator's combined output is post-processed line-by-line:

Enterprise Detection

Used for: WITH (ONLINE = ON) on index operations, and the Enterprise threshold in @RunnableUnder.

IF CAST(SERVERPROPERTY('Edition') AS NVARCHAR(500)) LIKE '%Enterprise%'
    OR CAST(SERVERPROPERTY('Edition') AS NVARCHAR(500)) LIKE '%Developer%'
    SET @IsEnterprise = 1;