Home All Groups Group Topic Archive Search About

Checking if a stored procedure exists

Author
8 Sep 2005 8:34 PM
RSH
Is there a way using a SQL Statement to see if a stored procedure exists in
SQL Server?

Author
8 Sep 2005 8:52 PM
JT
The following will work for SPs, tables, or basically any database object:
if object_id('MyProc') is not null

Show quote
"RSH" <way_beyond_o***@yahoo.com> wrote in message
news:e3NuzSLtFHA.1048@TK2MSFTNGP10.phx.gbl...
>
> Is there a way using a SQL Statement to see if a stored procedure exists
> in SQL Server?
>
Author
8 Sep 2005 8:59 PM
Jens Süßmeyer
Select 'Exists' where OBJECT_ID(Nameof thsp) IS NOT NULL

Select * from INFORMATION_SCHEMA.Routines where Routine_name =
'nameofyoursp'

HTH, Jens suessmeyer.




Show quote
"RSH" <way_beyond_o***@yahoo.com> wrote in message
news:e3NuzSLtFHA.1048@TK2MSFTNGP10.phx.gbl...
>
> Is there a way using a SQL Statement to see if a stored procedure exists
> in SQL Server?
>
Author
8 Sep 2005 9:24 PM
RSH
THANKS!!!


Show quote
"Jens Süßmeyer" <Jens@remove_this_for_contacting_sqlserver2005.de> wrote in
message news:uxi1AhLtFHA.236@TK2MSFTNGP11.phx.gbl...
> Select 'Exists' where OBJECT_ID(Nameof thsp) IS NOT NULL
>
> Select * from INFORMATION_SCHEMA.Routines where Routine_name =
> 'nameofyoursp'
>
> HTH, Jens suessmeyer.
>
>
>
>
> "RSH" <way_beyond_o***@yahoo.com> wrote in message
> news:e3NuzSLtFHA.1048@TK2MSFTNGP10.phx.gbl...
>>
>> Is there a way using a SQL Statement to see if a stored procedure exists
>> in SQL Server?
>>
>
>

AddThis Social Bookmark Button