April 19, 2006 at 12:07 pm
Is it possible to do the following?
Assume I have a big stored procedure (sp) sp_A, and a sub sp sp_B. Sp sp_B is used more than 1 time in sp sp_A. Istead of define and compile sp sp_B in a separate physical file on hard disk, I'd like to define and use it inside the body of sp sp_A like:
create procedure dbo.sp_A
as
-- start of sp_A ------------------------
...
-- use sp_B to do things
exec sp_B
...
-- use sp_B to do things
insert #t
exec sp_B
-- now to define sp_B inside the body of sp_A
-- create and then alter sp_B:
alter procedure dbo.ap_B
as
-- define sp_B
...
...
-- end of sp_A ------------------------
GO
Thanks for your ideas.
April 19, 2006 at 12:29 pm
If all you want is to have them in the same physical file, do this:
Create Proc spB (
)
As
Begin
....
end
GO
Create Proc spA (
)
As
Begin
....
end
GO
That way you won't get sysdepends errors.
This isn't really good coding practice, though. It will lead to all kinds of maintenance headaches.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply