Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. udf issue

udf issue

Scheduled Pinned Locked Moved Database
questioncsharpdatabasesysadminmcp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tauseef A
    wrote on last edited by
    #1

    hi guys i have a filed in my database named status which values is a bit either 0 or 1 , i want to get its values and wanto to translate 0 to inactive and 1 to active and i want to do it at server end in a udf ,how can i do that ? regards .

    Tauseef A Khan MCP Dotnet framework 2.0.

    B 1 Reply Last reply
    0
    • T Tauseef A

      hi guys i have a filed in my database named status which values is a bit either 0 or 1 , i want to get its values and wanto to translate 0 to inactive and 1 to active and i want to do it at server end in a udf ,how can i do that ? regards .

      Tauseef A Khan MCP Dotnet framework 2.0.

      B Offline
      B Offline
      Blue_Boy
      wrote on last edited by
      #2

      Hope you are looking for this. select case when status=0 then 'inactive' when status=1 then 'active' end as [Status] from tablename


      I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

      T M 2 Replies Last reply
      0
      • B Blue_Boy

        Hope you are looking for this. select case when status=0 then 'inactive' when status=1 then 'active' end as [Status] from tablename


        I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

        T Offline
        T Offline
        Tauseef A
        wrote on last edited by
        #3

        thanks i was just looking for that .

        Tauseef A Khan MCP Dotnet framework 2.0.

        B 1 Reply Last reply
        0
        • T Tauseef A

          thanks i was just looking for that .

          Tauseef A Khan MCP Dotnet framework 2.0.

          B Offline
          B Offline
          Blue_Boy
          wrote on last edited by
          #4

          You are welcome.


          I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

          1 Reply Last reply
          0
          • B Blue_Boy

            Hope you are looking for this. select case when status=0 then 'inactive' when status=1 then 'active' end as [Status] from tablename


            I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

            M Offline
            M Offline
            Mycroft Holmes
            wrote on last edited by
            #5

            I would use and else to trap the 2, -2 values

            Never underestimate the power of human stupidity RAH

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups