Rename a table,Easy using sp_rename,but how to use in C#

Today I came across an interesting question on how to rename a table in SQL Server.Thats a pretty easy one and we can use sp_rename to accomplish this.


However when a user needs it do via C#,then how can he/she do this.



To rename a table in a C# code, pass the sp_rename code as string to a SqlCommand object and call the SqlCommand.ExecuteNonQuery() method.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s