Converting Int to Text in View

  • I spend a lot of my time creating views in SQL 05 then transferring them to MS Excel or Crystal Reports for my users. The database I work in has no tablecode for Doc_Status. How do I convert the numeric (Small_Int) Document Status to read as Text in my reports. See example below

    4 = Open

    10 = Closed

    30 = Approved

    My users should not have to see the numbers. Any help would be greatly appreciated.

  • SELECT

    *,

    CASE DocumentStatus

    WHEN 4 THEN 'Open'

    WHEN 10 THEN 'Closed'

    WHEN 30 THEN 'Approved'

    ELSE 'Error'

    END AS StrDocumentStatus

    FROM

    dbo.tbl

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

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