query on the base of itemno in stored procedure

  • i have 4 queries in stored procedure i want to fire them on the basis of parameter

    if para=1

    then fire sql1

    if para=2 then

    fire sql2

    how do that ??

    <a href="http://www.websolsoftware.com"> For IT jobs click here</a>

    *Sukhoi*[font="Arial Narrow"][/font]

  • Maybe something like this:

    CREATE PROCEDURE usp_runproc

       @procparam  INT

    AS

       IF @procparam = 1

         BEGIN

           EXEC usp_procedure1

         END

       ELSE

       IF @procparam = 2

         BEGIN

           EXEC usp_procedure2

         END

       ELSE

       IF @procparam = 3

    <Rest of script>

    -SQLBill

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

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