Randomly selected quiz question (want a different question? Click here):
Recently, the following problem made me seriously doubt my sanity.
I had a perfectly ordinary stored procedure which had always been working fine. Then I made a change to an application with the result that various stored procedures were now executed in a remote ASE server a CIS RPCs. Whether you execute a stored proc locally or remotely as an RPC should not make any difference for its functionality, and indeed the procedures kept working fine. That is, with one exception: this particular stored proc consistently failed when executed as an RPC, and with an error message that didn't make sense to me.
Below is the (greatly simplified) reproduction of this problem. When executing the procedure locally, it works fine, but when running it as a CIS RPC, I get error 207 (using 'loopback' as a server name pointing back to the server itself is a quick way of reproducing this problem):
(NB: make sure the config parameter "cis rpc handling" is set to 1)
1> create proc p
3> exec('select objid=object_id("MyTab")')
1> exec p
(1 row affected)
1> exec loopback.my_db..p
Msg 207, Level 16, State 4
Server 'SYB1502', Line 1
Invalid column name 'MyTab'.
(return status = 0)
Obviously, I was doing something wrong. But what?
This stored procedure seemed too simple and innocent to contain any errors.
How would you solve this?
Click here for the answer.
More ASE quiz questions: 2013 - 2012 - 2011 - 2010 - 2009 - 2008 - 2007 - 2006 - 2005 - 2004 - 2003 - 2002 - 2001
For a randomly selected quiz question, click here.