Solved

Deleting stored procedures programmatically

Posted on 2006-07-07
6
294 Views
Last Modified: 2010-04-16
Is there any way to delete a stored procedure programatically?

Here is the way I create it:
"CREATE PROCEDURE dbo.ManagerTesterSP1 (@choice int, @sleep DateTime) AS      
if @choice = 1 begin return end else if @choice = 3 begin waitfor delay @sleep return end else if @choice = 2 begin declare @temp int declare @temp1 int set @temp = 0 set @temp1 = 1/@temp return end";
0
Comment
Question by:Identify1
6 Comments
 
LVL 16

Expert Comment

by:Swapnil Piparia
ID: 17056687
Hi Identify1,

execute sql "DROP PROCEDURE { procedure }" from command object with command.ExecuteNonQuery(sql)

Regards,
NetSwap
0
 
LVL 1

Accepted Solution

by:
mirzaAbazovic earned 500 total points
ID: 17056694
SqlCommand komanda = new SqlCommand("DROP PROCEDURE  ManagerTesterSP1", MyConnection);
komanda.CommandType = CommandType.StoredProcedure;
komanda.ExecuteNonQuery();

0
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 17064025
u could use the DROP PROCEDURE [proc name]

command and execute it using the sqlcommand.executenonquery()
command text of sqlcommand will be my above said query
0

Featured Post

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Login 17 51
C#.NET and microsoft certification. 3 42
WCF Service Application cannot connect from TCP terminal 1 33
InputLanguage 1 27
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question