How to call a stored procedure one after the other without a go

michaelrobertfrench
michaelrobertfrench used Ask the Experts™
on
Below is somewhat hard to read.  I suggest you paste into QA for easier readability.

You can assume the sp called "usp_update_core_corporate_activation" works.

It is called with the lines in the comment section:

            usp_update_core_corporate_activation 4,2009
            usp_update_core_corporate_activation 5,2009
            usp_update_core_corporate_activation 6,2009

How can I code this so the calls can happen without a go like this:


      usp_update_core_corporate_activation 4,2009
      go
      usp_update_core_corporate_activation 5,2009
      go
      usp_update_core_corporate_activation 6,2009




      if exists (select name from sysobjects where name = 'usp_update_core_corporate_activation' and type = 'p')
            drop procedure usp_update_core_corporate_activation
            go
            create procedure usp_update_core_corporate_activation
            (@base_month int, @base_year int)
            /*                              
            usp_update_core_corporate_activation 4,2009
            usp_update_core_corporate_activation 5,2009
            usp_update_core_corporate_activation 6,2009
            */
            as
                  update l
                  set [corporate_activation] = 1
                  from agentbankprogram..full_core l                                                                                                                               
                  where
                  (
                  base_month = @base_month and
                  base_year = @base_year and
                  l.acct_trans_stat not in ('t','m')  and                                        
                  l.acct_del_stat = ' '  and                                                
                  l.chrg_off_dt = ''  and                                            
                  l.cr_rating not in ('v9','f1','t5')  and                                      
                  l.bk_num in (4005) and
                  l.acct_num = l.oth_acct_num and
                  month(case when l.frst_use_dt <> '' then l.frst_use_dt else null end) =@base_month and
                  year(case when l.frst_use_dt <> '' then l.frst_use_dt else null end) =@base_year
                  )  
            go            
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Database Consultant
Top Expert 2009
Commented:
use EXEC
           EXEC  usp_update_core_corporate_activation 4,2009
            EXEC usp_update_core_corporate_activation 5,2009
          EXEC  usp_update_core_corporate_activation 6,2009

Author

Commented:
thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial