Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Call a procedure in another

Author  Topic 

marclas
Starting Member

16 Posts

Posted - 2012-05-08 : 01:10:32
hi,
I have a procedure Proc1 that insert items in a table Table0,
it also insert item in table1.

then i have another procedure Proc2 that just insert item in table1.
I want to know if is possible to call the Proc2 in Proc1 so that it replace the insert?

how can i do that

thanks

Marclas

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-05-08 : 02:15:53
to call procedure Proc2

exec Proc2



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

marclas
Starting Member

16 Posts

Posted - 2012-05-08 : 02:54:04
I clearly understand,

but whar about if proc2 has parameters?

shall i declare them in Prco1 that is calling proc2?

thx

Marclas
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-05-08 : 03:29:48
quote:
Originally posted by marclas

I clearly understand,

but whar about if proc2 has parameters?

shall i declare them in Prco1 that is calling proc2?

thx

Marclas



not necessary, but you do need to supply the required value to the parameters for Proc2

exec Proc2 @para1 = 'somevalue', @para2 = 1234, @para3 = @another_var



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -