HawaiiDragon
asked on
SQL combined functions in one stored procedure
Okay I was trying to be cheep with stored procedure memory and I am wonderin if any of you out there have any ideas.
1. I have 1 stored proce that calls 2 variables. Email and IRBTurnCounter, This proc calls for the lowest number (int) by desc so I get my email address to mail off the form with. Then I need the 'IRBTurnCounter' to increment by one so all the members of the table get called so everyone gets one email (eventually not at the run of this proc) Man I hope this makes sence!
2. What I have created works if ther are values placed in the fields at runtime... HOWEVER I need the values to be called and placed from the proc its self. I would rather not do it in two procs but if I have to than I have to.
Thanks for all the help in advance
HD
1. I have 1 stored proce that calls 2 variables. Email and IRBTurnCounter, This proc calls for the lowest number (int) by desc so I get my email address to mail off the form with. Then I need the 'IRBTurnCounter' to increment by one so all the members of the table get called so everyone gets one email (eventually not at the run of this proc) Man I hope this makes sence!
2. What I have created works if ther are values placed in the fields at runtime... HOWEVER I need the values to be called and placed from the proc its self. I would rather not do it in two procs but if I have to than I have to.
Thanks for all the help in advance
HD
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
Alter PROCEDURE [dbo].[P_sp_EmailerProgram]
-- Add the parameters for the stored procedure here
@Email nvarchar(50),
@IRBTurnCounter int
AS
/* SET NOCOUNT ON */
select top 1 Email, IRBTurnCounter from tbl_IRBMembors Order by IRBTurnCounter Desc
UPDATE tbl_IRBMembors
SET
IRBTurnCounter = @IRBTurnCounter + 1,
Email = @Email
WHERE Email = @Email
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER