Help with decode equivalent in sql server 2005

  • Please help with decode sql server equivalent. How can I change this code to work in sql server 2005 by replacing the decode syntax or modifying it to work in sql server.

    SELECT v_R_System.Name0,

    decode(v_GS_SoftwareFile.FileName, 'sqlservr.exe',

    decode(v_GS_SoftwareFile.FilePath, 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\',v_GS_SoftwareFile.FileVersion)) AS SQLSERVR,

    decode(v_GS_SoftwareFile.FileName, 'sqlagent90.exe',

    decode(v_GS_SoftwareFile.FilePath = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\',v_GS_SoftwareFile.FileVersion)) AS SQLAGENT90,

    decode(v_GS_SoftwareFile.FileName, 'msftesql.exe',

    decoed(v_GS_SoftwareFile.FilePath = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\',v_GS_SoftwareFile.FileVersion)) AS MSFTESQL,

    decode(v_GS_SoftwareFile.FileName, 'MsDtsSrvr.exe',

    decode(v_GS_SoftwareFile.FilePath, 'C:\Program Files\Microsoft SQL Server\90\DTS\Binn\',v_GS_SoftwareFile.FileVersion)) AS MSDTSSRVR,

    decode(v_GS_SoftwareFile.FileName, 'sqlwriter.exe',

    decode (v_GS_SoftwareFile.FilePath, 'C:\Program Files\Microsoft SQL Server\90\Shared\',v_GS_SoftwareFile.FileVersion)) AS SQLWRITER,

    decode(v_GS_SoftwareFile.FileName, 'sqladhlp90.exe',

    decode(v_GS_SoftwareFile.FilePath, 'C:\Program Files\Microsoft SQL Server\90\Shared\',v_GS_SoftwareFile.FileVersion)) AS SQLHELPER,

    decode(v_GS_SoftwareFile.FileName, 'sqlbrowser.exe',

    decode(v_GS_SoftwareFile.FilePath, 'C:\Program Files\Microsoft SQL Server\90\Shared\',v_GS_SoftwareFile.FileVersion)) AS SQLBROWSER,

    decode(v_GS_SoftwareFile.FileName,'ReportingServicesService.exe',

    decode(v_GS_SoftwareFile.FilePath, 'C:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer\bin\',v_GS_SoftwareFile.FileVersion)) AS SQLREPORTING

    FROM v_R_System , v_GS_SoftwareFile

    where v_R_System.ResourceID = v_GS_SoftwareFile.ResourceID

    and (v_R_System.Name0 IS NOT NULL)

    ORDER BY v_R_System.Name0

  • You may want to read:

    http://www.microsoft.com/technet/prodtechnol/sql/70/proddocs/admincmp/75517c11.mspx?mfr=true

    Chapter 11 - Migrating from Other Products to SQL Server

    and scroll to the part:

    Migrating DECODE Functions from Oracle to SQL Server

    In this article they have a syntax and the example.

    Regards,Yelena Varsha

Viewing 2 posts - 1 through 1 (of 1 total)

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