| Author |
Topic |
|
Spherix
Starting Member
4 Posts |
Posted - 2010-12-24 : 01:31:14
|
Hey... For the life of me I can't figure out why I get an error when trying to re name this file so I can attach a new one. ^^^ This is the error I get ^^^My first theory was that the file was in-use somewhere. It isn't.I figured out if I attempt to delete this before I attach the new file then I get kicked out of the DB and cant re-connect till I re-install the files.If anyone knows what my problem is or how to help me then please comment :) |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
Spherix
Starting Member
4 Posts |
Posted - 2010-12-24 : 01:35:43
|
I'm just right clicking on the file and attempting to re name it. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
Spherix
Starting Member
4 Posts |
Posted - 2010-12-24 : 01:42:27
|
| Im a bit on the, well stupid side when it comes to SQL I've been working with it for all of 6 hrs now and I have no clue what to open or what command to throw at it to re name this database, could you tell me ? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-12-24 : 03:35:16
|
| Use query analyser and run thisuse masterGoEXEC sp_renamedb 'Old_name', 'New_name'If you get an error, runEXEC sp_who and see who are all connected to your old dbMadhivananFailing to plan is Planning to fail |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-12-24 : 03:46:12
|
Well ... here is a belt & braces approach:USE masterGOALTER DATABASE MyOldDatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATEGOALTER DATABASE MyOldDatabaseName MODIFY NAME = MyNewDatabaseNameGOALTER DATABASE MyNewDatabaseName SET MULTI_USER GO Note that this will only change the name of the database, not the physical names of the files, nor their logical names, which if left unchanged may be confusing in the future |
 |
|
|
Spherix
Starting Member
4 Posts |
Posted - 2010-12-26 : 18:54:39
|
| It worked for the re-name but I am now un able to connect to my database, and I need to attach a new database for it to work again :S |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|