[SOLVED] Ghost of a SQL Server function

Posts   
 
    
JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 27-Jan-2005 20:54:56   

Almost the title of a great movie, huh?

In a previous incarnation of my database I had a SQL Server function POUserID() and the default for a field was set to this function.


   CreatedBy int NOT NULL DEFAULT dbo.POUserID()

Now for the web version of my application I have done away with this. I have recreated the database, and the there is NO reference to this function, I have triple-verified this.

This code


        public void SavePO(POEntity po)
        {
            DataAccessAdapter adapter = new DataAccessAdapter();
            adapter.SaveEntity(po, po.IsNew);
        }

throws this exception


An exception was caught during the execution of an action query: Invalid object name 'dbo.POUserID'.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception. 

The obvious thing is somehow I've missed something and this function is still lurking. But it ain't.

confused

JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 27-Jan-2005 20:55:58   

Oh yeah, I loaded profiler to see what SQL was getting sent over, but no SQL to update the table ever made it.

bertcord avatar
bertcord
User
Posts: 206
Joined: 01-Dec-2003
# Posted on: 27-Jan-2005 21:39:30   

JimFoye wrote:

Oh yeah, I loaded profiler to see what SQL was getting sent over, but no SQL to update the table ever made it.

so you se nothin gon profiler...did you double check you conneciton string..maybe your are conecting to a different server than you think...

bert

JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 27-Jan-2005 21:42:37   

Ah, good try! The old db is actually on another server, but I double-checked by connection string. Also that box is physically off the network now (just verified).

JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 27-Jan-2005 23:30:28   

OH YUCK - It's my fault! I'm using triggers to do auditing and I still have a reference to this function in the trigger script. I just assumed it was gone completely from the database but of course it's not. Sorry for the trouble.

Now I realize I will have to revise my auditing scheme, since I'm connecting to SS using standard security instead of integrated security, as I was in the Access version. Guess maybe that's another thing I should do in my middle tier...