You are here: Re: Sql Server incorrectly functioning « MsSQL Server « IT news, forums, messages
Re: Sql Server incorrectly functioning

Posted by Erland Sommarskog on 05/25/05 23:10

Steve (fizzy1236@yahoo.com) writes:
> I have a .NET application with a sql server database backend. Our
> client has been having problems lately with data being returned from
> the database with wrong data. We have error logging in our stored
> procedures and even this is reporting wrong. In every stored procedure
> we have the following:
>
> IF @@Error <> 0
> BEGIN
> EXEC dbo.HandleError
> @ErrorNum = @@Error,
> @ProcID = @@PROCID
> END

I've bad news for you: you have lots of stored procedures to edit.
@@error is set after each statement, and that includes IF. So by the
time execution reaches the EXEC statement @@error is 0.

I have an article on my web site about error handling in stored procedures
that you may find useful, http://www.sommarskog.se/error-handling-II.html.

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация