I want to copy my database mdf and ldf files programmatically and also change their names.
I tried File.Move() and “Alter database mydb modify file …” and “use master exec sp_detach_db mydb” but i recieve this error “user doesnt have permission to do this action” or other errors like this.
note that i am an administrator user.
please help me
I want to copy my database mdf and ldf files programmatically and also change
Share
Try this it will work to rename the database
Here Test is your old database name and MyTest is new database name.
And one thing i want to tell you is You can not change the name of your system database name.
and MYDB is system database.