Is It Possible To Use CASE Statement With SERVERPROPERTY Element

  • Hi Folks

    is there anyway to incorporate a CASE statement with SERVERPROPERTY such as in the example (that does not work) below ?

    Thanks

    Jim

    -------------

    select

    CAST (SERVERPROPERTY('EngineEdition') as varchar (20)) AS 'EngineEdition',

    CASE SERVERPROPERTY('EngineEdition')

    WHEN '1' THEN 'Personal/Desktop'

    WHEN '2' THEN 'Standard/Workgroup'

    WHEN '3' THEN 'Enterprise/Evaluation/Developer'

    WHEN '4' THEN 'Express/Advanced Services/Embeded SQL'

    ELSE

    'Unknown EngineEdition'

    END SERVERPROPERTY('EngineEdition')

    go

  • Try this:

    select case (select serverproperty('engineedition'))

    WHEN '1' THEN 'Personal/Desktop'

    WHEN '2' THEN 'Standard/Workgroup'

    WHEN '3' THEN 'Enterprise/Evaluation/Developer'

    WHEN '4' THEN 'Express/Advanced Services/Embeded SQL'

    ELSE

    'Unknown EngineEdition'

    END as Engine

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • I'd do what Gus has listed.

  • Hi GSquared

    thanks very much, it worked

    i did have to take the quotes off the numbers as the value is integer (my fault)

    other than that, BEAUTIFUL !

    Appreciate it

    Jim

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply