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
 General SQL Server Forums
 New to SQL Server Programming
 Putting two stored procedures together

Author  Topic 

crugerenator
Posting Yak Master

126 Posts

Posted - 2008-11-25 : 16:07:47
I want to put two stored procedures together so both select statements run from the one proc call. Is it possible?

proc 1:


CREATE PROCEDURE sp_updateProfile
@profileID numeric,
@profileName varchar(100),
@add1 varchar(100),
@add2 varchar(100),
@add3 varchar(100),
@city varchar(100),
@state varchar(100),
@zip varchar(100),
@phone varchar(100),
@hours varchar(100)
AS
UPDATE [Profile]
SET profileName= @profileName, contact = @contact, addressLine1 = @add1, addressLine2 = @add2, addressLine3 = @add3, city = @city, state = @state, zip = @zip, phoneNumber = @phone, hours = @hours
WHERE profileID = @profileID
GO


proc 2:


CREATE PROCEDURE sp_insertActivity
@userID numeric,
@logdata varchar(1000)

as
INSERT INTO [ActLog](actTypeID,userID,actDate,actDetail)
VALUES (15,@userID,GetDate(),@logdata)
go

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-11-25 : 17:14:15
CREATE PROC SomeProc
(@var1 int, @var2 int, ...)
AS

SELECT ...

SELECT ...

UPDATE...

GO

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

crugerenator
Posting Yak Master

126 Posts

Posted - 2008-11-25 : 17:32:52
Excellent, thank you. Google made it seem like there was a lot more to it.
Go to Top of Page
   

- Advertisement -