Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling stored procedure in different database

Status
Not open for further replies.

varocho

Programmer
Dec 4, 2000
238
US
Using: PowerBuilder 6.5.1, SQL Server 7.0

My application connects to a database but needs to call a stored procedure in the 'master' database on the same server. Here's what I have for the stored procedure declaration:

DECLARE decrypt_password PROCEDURE FOR master..stp_verify
@crypt_word = :as_encrypted_word,
@ver_word = :as_word
USING joinge_tran;

If this is changed to

DECLARE decrypt_password PROCEDURE FOR stp_verify
...

and my database transaction object is set up to connect to the 'master' database, then all is well. But I need to connect to another database to do updates and using

DECLARE decrypt_password PROCEDURE FOR master..stp_verify
...

doesn't work. I get the following error message:

Error converting data type varchar to int

Any ideas, anyone?
 

If the name of the stored procedure begins with "sp_" and is created in master, it can be called from the context of any database without qualifying the name. Using the "sp_" prefix on master stored procedures makes them system stored procedures executable from any database. The following should work if you rename the stored procedure.

DECLARE decrypt_password PROCEDURE FOR sp_verify
... Terry
------------------------------------
Blessed is the man who, having nothing to say, abstains from giving us worthy evidence of the fact. -George Eliot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top