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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-03-15 : 08:20:30
|
| Willo writes "My problem is that I have some Client Apps that I don't want to change and these apps don't handle errors. So, my idea is handle the errors in the stored procedures using the @@ERROR global variable. I can use this variable and handle the error as I want but the Error is always raised to the Client App and it crashs (because it doesn't have error handling).This is a simple example. It creates a sample table, the stored procedure and the execution. I want that 'myProc' stored procedure doesn't raise the NULL Constraint Error.CREATE TABLE myTable(Column1 int IDENTITY,Column2 int NOT NULL)GOCREATE PROCEDURE myProc@Column2 int = NULLASINSERT myTable VALUES (@Column2)IF @@Error <> 0 BEGIN INSERT myTable VALUES (0) ENDGOEXEC myProc" |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-03-15 : 12:37:14
|
| It has to raise the error though. Your example violates the table's definition. The stored procedure needs to be changed so that it doesn't do the violation.Tara |
 |
|
|
|
|
|