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.
sp_rename ‘OLD_TABLE_NAME’ , ‘NEW_TABLE_NAME’
However when a user needs it do via C#,then how can he/she do this.
Solution
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.