Sunday, February 19, 2012

Checking if a stored procedure exists

Is there a way using a SQL Statement to see if a stored procedure exists in
SQL Server?The following will work for SPs, tables, or basically any database object:
if object_id('MyProc') is not null
"RSH" <way_beyond_oops@.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?
>|||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_oops@.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?
>|||THANKS!!!
"Jens Smeyer" < Jens@.remove_this_for_contacting_sqlserve
r2005.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_oops@.yahoo.com> wrote in message
> news:e3NuzSLtFHA.1048@.TK2MSFTNGP10.phx.gbl...
>

No comments:

Post a Comment