Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-09-14 : 09:48:50
|
| Louis writes "Is it possibble to write a SQL statement that returns "True" or "False" if a stored procedure exists. Basically write a SQL statement that checks whether or not the Stored Procedure exist in the database???Thanks in advance" |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-09-14 : 09:53:10
|
many ways to do it:1) IF EXISTS (SELECT name FROM sysobjects WHERE name = N'proc1' AND type = 'P') 2) If Exists (Select * from Information_schema.Routines Where Routine_Name = 'Proc1' Harsh AthalyeIndia."Nothing is Impossible" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-09-14 : 09:53:11
|
| If exists*Select * from sysobjects where xtype='p' and name='Procedure name')Print 'True'elsePrint 'False'MadhivananFailing to plan is Planning to fail |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-09-14 : 09:54:01
|
MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|