Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored Procedure Help.

Status
Not open for further replies.

limester

Technical User
Dec 29, 2004
69
CA
I am looking to create a stored procedure that will populate a text box depending on the result of a field. The field has many values and for each one it will require different text.

To query for the field I will need to join another table:

table1.field1 where table1.field2=table2.field2

If anyone can help me with a starting point to this it would be greatly appreciated.

thanks.
 
limestr

The case statement should work for you.
Code:
SELECT    t.fieldstuff = 
        CASE type
            WHEN 'vAL1' THEN 'thisname'
            WHEN 'val2' THEN 'othername'
            WHEN 'Val3' THEN 'somename'
            ELSE 'return somthing else'
        END,

FROM Mytable T

WHere Bla Bla Bla

As far as you join you going to have to provide more info ... the table name and what fields you want

 
Hi Dashley,

Thank you for your reply!

I think using a case statemnet is exactly what I need to do!

I will work on this and reply as to my success or failure.

Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top