Like Frans and Miha Mention, I'd use Information_Schema as the preferred
method, but you can use the ADO.NET version as well.
Just as an additional method you can use the good old fashioned
if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[usp_myProc]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
strSQL = "SELECT Count(*) FROM dbo.sysobjects WHERE id =
object_id(N'[dbo].[MySproc]') and xtype IN (N'FN', N'IF', N'TF')"
NumRecs = CInt(.ExecuteScalar(strSQL))
If NumRecs = 1 Then
'Sproc exists.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.