Professional Web Applications Themes

Enumerators - Replace Numeric Values with Text - Microsoft SQL / MS SQL Server

Hi all, I have a column which looks like this: Status ID ========= 100 100 100 200 100 300 100 I want the output to be: Status ID ========= IDLE IDLE IDLE RUNNING IDLE SYNCRONIZING IDLE Any ideas on how to write the Select statement? Thanks. -- Lucas Tam (REMOVEnntprogers.com) Kodak DC240 Digital Zoom Camera w/ EXTRAs for Auction! 99c! [url]http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=2937992463[/url]...

  1. #1

    Default Enumerators - Replace Numeric Values with Text

    Hi all,


    I have a column which looks like this:


    Status ID
    =========
    100
    100
    100
    200
    100
    300
    100

    I want the output to be:

    Status ID
    =========
    IDLE
    IDLE
    IDLE
    RUNNING
    IDLE
    SYNCRONIZING
    IDLE

    Any ideas on how to write the Select statement? Thanks.

    --
    Lucas Tam (REMOVEnntprogers.com)

    Kodak DC240 Digital Zoom Camera w/ EXTRAs for Auction! 99c!
    [url]http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=2937992463[/url]
    Lucas Tam Guest

  2. #2

    Default Re: Enumerators - Replace Numeric Values with Text

    select [Status ID]= case [Status ID] when 100 then 'IDLE' when 200 then
    'RUNNING' when 300 then 'SYNCRONIZING' else 'UNKNOWN' end from TABLE

    peter

    "Lucas Tam" <REMOVEnntprogers.com> wrote in message
    news:Xns93ADA31044150nntprogerscom140.99.99.130.. .
    > Hi all,
    >
    >
    > I have a column which looks like this:
    >
    >
    > Status ID
    > =========
    > 100
    > 100
    > 100
    > 200
    > 100
    > 300
    > 100
    >
    > I want the output to be:
    >
    > Status ID
    > =========
    > IDLE
    > IDLE
    > IDLE
    > RUNNING
    > IDLE
    > SYNCRONIZING
    > IDLE
    >
    > Any ideas on how to write the Select statement? Thanks.
    >
    > --
    > Lucas Tam (REMOVEnntprogers.com)
    >
    > Kodak DC240 Digital Zoom Camera w/ EXTRAs for Auction! 99c!
    > [url]http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=2937992463[/url]

    Peter Notebaert Guest

  3. #3

    Default Re: Enumerators - Replace Numeric Values with Text

    "Peter Notebaert" <penomailme.org> wrote in news:L71Na.5118$7h.9726
    afrodite.telenet-ops.be:
    > select [Status ID]= case [Status ID] when 100 then 'IDLE' when 200 then
    > 'RUNNING' when 300 then 'SYNCRONIZING' else 'UNKNOWN' end from TABLE

    Ah... Thanks. I didn't think of using the case statement!


    --
    Lucas Tam (REMOVEnntprogers.com)

    Kodak DC240 Digital Zoom Camera w/ EXTRAs for Auction! 99c!
    [url]http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=2937992463[/url]
    Lucas Tam Guest

Similar Threads

  1. Getting the values of a series of numeric steppers
    By Steve L in forum Macromedia Flex General Discussion
    Replies: 0
    Last Post: July 12th, 06:36 PM
  2. Numeric values
    By plaustrum in forum Coldfusion Database Access
    Replies: 2
    Last Post: January 8th, 12:50 PM
  3. Unable get Boolean and Numeric values from XLS into Dataset and Datagrid
    By vighnesh in forum ASP.NET Data Grid Control
    Replies: 3
    Last Post: August 4th, 02:16 PM
  4. How to convert timestamp values to numeric (SQL70)
    By Russell Fields in forum Microsoft SQL / MS SQL Server
    Replies: 2
    Last Post: July 8th, 10:09 PM
  5. Replies: 2
    Last Post: July 3rd, 07:38 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139