PRB: Error Creating Stored Procedure (42624)



The information in this article applies to:

  • Microsoft SQL Server 7.0

This article was previously published under Q42624

SYMPTOMS

When using the following procedure as a stored procedure:
   Create procedure workshop as
   use pubs
   select * from authors
				
after pressing the CTRL+E keys in Query Analyzer, the following error message is displayed:
Server: Msg 154, Level 15, State 1, Procedure workshop, Line 2 A USE DATABASE statement is not allowed in a procedure or trigger.
Deleting the USE PUBS command returns the following error message:
Server: Msg 208, Level 16, State 1, Procedure workshop, Line 2 Invalid object name 'authors'.

Modification Type:MinorLast Reviewed:3/2/2005
Keywords:kbprb kbprogramming KB42624