Microsoft KB Archive/42624

From BetaArchive Wiki
Knowledge Base

PRB: Error Creating Stored Procedure

Article ID: 42624

Article Last Modified on 3/2/2005


  • Microsoft SQL Server 7.0 Standard Edition

This article was previously published under Q42624


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'.

Keywords: kbprogramming kbprb KB42624