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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting default database in Stored Procedure.

Status
Not open for further replies.

CapsuleCorpJX

IS-IT--Management
Jun 23, 2004
70
US
In a stored procedure, I tried using:

DATABASE <database name>

But it wouldn't work.

It does work when I'm using the statement outside of a stored procedure.

Is there a work around or an equiv statment?
 
DATABASE is unsupported syntax in SPs, but you can fully qualify table names, e.g. databasename.tablename.

If object names are not qualified the default database at the time when the SP was created is used.

Dieter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top