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.

 All Forums
 Development Tools
 Other Development Tools
 1 Proc, 2 Proc, Red Proc, Blue Proc

Author  Topic 

SamC
White Water Yakist

3467 Posts

Posted - 2005-04-06 : 10:50:57
I've got an ASP page which, depending on the context can call one of two stored procs.

There's an error that's eluding me - somehow, a NULL is trying to be inserted where it should not. Trouble is, both procs insert in that table, but neither seems to be the culprit.

The error message that I display in ASP states the error, but not the name of the stored procedure:
quote:
Error Number: -2147217900
Script: /ad/ad/ad-useredit.asp
Native Error: 515
SQLState: 23000
Source: Microsoft OLE DB Provider for ODBC Drivers
Description: [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert the value NULL into column 'MyCol', table 'mydb.dbo.Users'; column does not allow nulls. INSERT fails.


Is there any way I can do something in either proc such that the name of the stored proc is returned in the error to ASP? Unfortunately, it looks like I'll need to pass a parameter to the ASP error reporting routine with a unique ID to include about the line invoking the error...

.Execute ,,adExecuteNoRecords
If CheckADOErrors(.ActiveConnection) Then
Response.End()
End If



tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-04-06 : 13:47:54
Use SQL Profiler to determine which stored procedure is causing the problem. You'll need to add exceptions to the trace. Then the row right after the exception will be the culprit.

Tara
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-04-06 : 16:51:04
Also when passing parameters are you setting defaults to those parameters? For instance, I was having a very similiar issue on a procedure I think it was an update procedure that required a value for a parameter. Even if that value was null (which I did not set as a default). After I added a default to the parameter my issue vanished. I try to design with very little null acceptance, those nulls always seem to be the culprits!


Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2005-04-06 : 22:17:08
Wouldn't the logic of the ASP page know which proc it is trying to call? Could you just show that when you get an error?



CODO ERGO SUM
Go to Top of Page
   

- Advertisement -