I have written one sample Sql stored procedure.
USE [Db]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[usp_TestProcedure]
AS
BEGIN
SET NOCOUNT ON;
PRINT 'Good evening'
END
Its working fine. Now I want to read and alter this stored procedure (and db object like function and view) using c#. Can it be done using c# ?
I am using Server 2014 and C#4.5.
Manoj BhoirPosted May 22, 2015, 2:21 AM
Why not? You can alter any type of SQL Object like Table, View, Function, Store Procedure using ALTER Command. You can Use SQLCommand Class and ExecuteNonQuery method.
See below sample code which will show you how to alter table and add new column :
Same you can use for other objects of SQL Server.