473,386 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

sql server2000 how do i stop running a stored procedure

Hi,
My sp creates an error report.
at a certain stage i want it to stop running if there
are errors in thar report.
I wrote:
Expand|Select|Wrap|Line Numbers
  1. DECLARE @myparam INTEGER
  2. SELECT @myparam=COUNT(*) FROM report_errors1
  3.   IF (@myParam>0)
  4.     BEGIN
  5.       print 'stop running due to existing errors ! '
  6.       commit
  7.     END
but unfortunately after printing the above message,
the procedure operates next commands.
I wonder if anyone will be kind enough to correct the above
code that is not doing what i wanted it.
Thank a lot !
Apr 14 '07 #1
1 3490
iburyak
1,017 Expert 512MB
Try this:


[PHP]
DECLARE @myparam INTEGER
SELECT @myparam=COUNT(*) FROM report_errors1
IF (@myParam>0)
BEGIN
print 'stop running due to existing errors ! '
Return
END[/PHP]

You ca n simplify this code like this:


[PHP]
IF (SELECT COUNT(*) FROM report_errors1) > 0
BEGIN
print 'stop running due to existing errors ! '
Return
END[/PHP]

Good Luck.
Apr 14 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Jeremy | last post by:
Hi, I am having a problem running an sql stored procedure with ADO/ASP. If I hard code a select statement, the code works, but when I try to use a stored procedure it bombs. Here is my code: ...
1
by: Martin Feuersteiner | last post by:
Dear Group I'm having a very weird problem. Any hints are greatly appreciated. I'm returning two values from a MS SQL Server 2000 stored procedure to my ASP.NET Webapplication and store them...
6
by: amitavabardhan | last post by:
How can I return an error code from a sql server stored procedure and use it in my asp page to generate an alert indicating that some error has ocurred?
1
by: magic man via .NET 247 | last post by:
hi everyone i have a c# application that uses multithreading toconnect to sql server and execute a stored procedure on theserver. i am using a dataset,sqlcommand,dataadapter and adatagrid to carry...
2
by: McGeeky | last post by:
I use page_load to call a stored procedure and populate the form. When the user clicks the OK button on the form I have implemented an event handler behind it (OKButton_Click()) that calls another...
0
by: stand__sure | last post by:
Stepping into a stored procedure used to be fairly straight-forward, but after following the guidance in all 6 or so of the MSDN pages about enabling debugging of stored procedures in SQL Server...
3
by: Roger Withnell | last post by:
I have a framed website. I plan to include in default.asp a routine to check if the annual subscription is due from the records in the People table. If so, then the routine would send emails...
7
by: Jerry | last post by:
I'm trying to execute a stored procedure in a loop while paging through database table records but the stored procedure isn't running. I get the folowing error: The component 'adodb.connection'...
4
by: nishi57 | last post by:
I hope I can get some help regarding this issue, which has been going on for a while. I have a desktop user who is having problem running "Stored Procedures". The DB2 Connect application works fine...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.