سؤال

I am using the Visual Studio C# Express edition and it comes with SQL Server for Database. I need the stored procedure sp_rename so that I can call it in my software to change specified table names.

Is there any way that I can import it from somewhere or get it by chance, because I notice that SQL Server in Visual Studio is limited and does not have the predefined stored procedure like the full version of SQL Server.

Is there any way to import certain stored procedures into my SQL Server for Visual Studio C# Express Edition?

I can run stored procedures, I just do not have the ones you usually get when you buy the complete SQL Server.

The following is my code. It will change the name of the database.

 SqlConnection sqlConnectionCmdString = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Rick\Documents\Visual Studio 2010\Projects\Server\database\ClientRegit.mdf;Integrated Security=True;User Instance=True");
string renameCommand = "EXEC sp_rename 'NetworkAccount' , 'oldhires'";
SqlCommand sqlRenameCommand = new SqlCommand(renameCommand, sqlConnectionCmdString);
sqlConnectionCmdString.Open();
sqlRenameCommand.ExecuteNonQuery();
sqlConnectionCmdString.Close();
هل كانت مفيدة؟

المحلول

sql server express contains full set of standard/basic stored procedures, including sp_rename

most likely you mistyped procedure name or have problems with permissions

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top