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.
| Author |
Topic |
|
reddymade
Posting Yak Master
165 Posts |
Posted - 2007-03-07 : 09:19:30
|
| I have the following stored proc and would like to have an exit statement right after the first line, since my company asked me not to run the process, i don't want to comment each line, instead is it possible to have exit statement right after declare, that way i can remove the exit statement when my company again want the process to run. Please help.Thank you very much for the information.*****************************************************************set ANSI_NULLS ONset QUOTED_IDENTIFIER ONGOALTER PROCEDURE [dbo].[USP_PSendMail] ASdeclare @recipient varchar(255)declare @subject varchar(255)declare @mailbody varchar(8000)declare @emailid intdeclare hCx cursor forSelect toemail,emailsubject,body,emailid from tab_netemailsumwhere alerttime is null or alerttime <= getdate()open hCxfetch hCx into @recipient,@Subject,@mailbody,@emailiddelete tab_ccsnetemailsum where emailid=@emailidif( @@fetch_status =0)Begin if @recipient is not null begin EXEC msdb.dbo.sp_send_dbmail @profile_name = 'companyMail', @recipients=@recipient, @body = @mailbody, @subject=@Subject endEndwhile @@fetch_status = 0Beginfetch hCx into @recipient,@Subject,@mailbody,@emailid delete tab_ccsnetemailsum where emailid=@emailid if( @@fetch_status =0) Begin if @recipient is not null begin EXEC msdb.dbo.sp_send_dbmail @profile_name = 'compamnyMail', @recipients=@recipient, @body = @mailbody, @subject=@Subject end EndEndclose hCxdeallocate hCx**************************************************************** |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-03-07 : 09:25:20
|
| There is no EXIT statement, use RETURN instead.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
|
|
|
|
|