Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002
    Location
    Maryland US
    Posts
    1

    Exclamation Unanswered: Returning Values in a stored procedure

    Does anyone out there know how to create a stored procedure that will return results based on the information queried?

    For example:

    I have a table myTable With the following fields:
    anIdentifier, anAction, data1, data2, data3, data4

    I want to be able to do something like:

    select * from myTable where anIdentifier = 123
    if anAction = 1 return anIdentifier, anAction, data1, data3
    if anAction = 2 return anIdentifier, anAction, data2, data3
    if anAction = 3 return anIdentifier, anAction, data1, data2, data3

    Can a stored procedure be created that can do this or am I just dreaming?

  2. #2
    Join Date
    Aug 2002
    Posts
    6

    Re: Returning Values in a stored procedure

    Originally posted by rwaver
    Does anyone out there know how to create a stored procedure that will return results based on the information queried?

    For example:

    I have a table myTable With the following fields:
    anIdentifier, anAction, data1, data2, data3, data4

    I want to be able to do something like:

    select * from myTable where anIdentifier = 123
    if anAction = 1 return anIdentifier, anAction, data1, data3
    if anAction = 2 return anIdentifier, anAction, data2, data3
    if anAction = 3 return anIdentifier, anAction, data1, data2, data3

    Can a stored procedure be created that can do this or am I just dreaming?
    you can try to use case ... when ... then ....

Posting Permissions

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