How Create a store procedure from another store procedure

  •  i can create a view from another view for example :

    create view viewX

    as

    select o.Locationid,o.Itemcode,o.openingdate,o.openingQty

            from view1 as o

           ………..

           left  join view2 as MR on o.Locationid=MR.Locationid

           left join  view3 as TR on o.Locationid=TR.Locationid        

           left join view4 as TI on o.Locationid=TI.Locationid …….     

          where .......

    so if i use here store procedure, how can i do this as above?



    ..Better Than Before...

  • Yes there is a way to create a stored from from an another SP

    create proc sp1

    as

    declare @STR varchar(1000)

    set @STR = 'create proc sp2 as select * from t'

    exec (@str)

    go



    Bye
    Gabor

  • ok, let it more clear!

    I have a view view1 where material receiving information is summarized along with location id ,date and other necessary info

     

    I have another view view2 where all sales information is summarized along with location id with location id ,date and other necessary info

     

    I have another view view3 where all sales return information is summarized along with location id with location id, date and other necessary info

    ……

    in this way I have several views

     

    now finally I have a Summary view "viewSummary" where previously created views are linked

    with locationid , date and other necessary info to produce  the current stock.

     

    Now, user can watch stock with in a date period. so I need to pass a parameter to the view to minimize the data and to fill the user req. But passing parameter to a view is not possible so I wants to make it a store procedure SP1,SP2…. Similarly view1,view2….

    And like last summary view ” viewN” – summary store procedure “SPSummary”

    to  produce  the current stock.

     

    But in the store procedure how to do this one?

     



    ..Better Than Before...

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

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