Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

One stupid question - How do rename a database in EM 4

Status
Not open for further replies.

Rousseau10

Programmer
Joined
Feb 22, 2005
Messages
242
Location
US
One stupid question - How do rename a database in EM

sorry for such begginer question!!!

I was the first American Soldier to put a basketball hoop up in Iraq, only to have it stolen by a soldier from different camp. Newbee - Adam
 
not sure if you can do it through enterprise manager. In code you can do
Code:
ALTER DATABASE database 
MODIFY NAME = new_dbname


"I'm living so far beyond my income that we may almost be said to be living apart
 
Ill try it. I accidentally but a space in my table name and could not right click and select rename. haha. thanx

I was the first American Soldier to put a basketball hoop up in Iraq, only to have it stolen by a soldier from different camp. Newbee - Adam
 
I got an error message when I executed this statement in Query Analyzer

ALTER DATABASE My Business
MODIFY NAME = MyBusiness

error message: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near '='.


What is wrong here, an more importantly, what is level 15, State 1 what is a level and state in SQL???


TANX!!

I was the first American Soldier to put a basketball hoop up in Iraq, only to have it stolen by a soldier from different camp. Newbee - Adam
 
When names have spaces, you need to add the text qualifier. One or both of the following should work.

Code:
ALTER DATABASE 'My Business'
MODIFY NAME = MyBusiness

OR

ALTER DATABASE [My Business]
MODIFY NAME = MyBusiness

hope this helps.


-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
My advice is to be certain that you really NEED to rename your database. It can cause DTS packages to have problems, for example.

I know I lived thru a renamed db - we decided to change it back to the original name.

John

 
good tip, I will remember! In this case I jsut created it and is not included in any packages yet!

I was the first American Soldier to put a basketball hoop up in Iraq, only to have it stolen by a soldier from different camp. Newbee - Adam
 
Here's a good thing to keep in mind when coding in TSQL.

Words with spaces and reserved words must be enclosed with either single quotes or square brackets.

'My Business'
[My Business]
[Date]

-SQLBill

Posting advice: FAQ481-4875
 
I wrote that tip down! thanks again SQLBill

I was the first American Soldier to put a basketball hoop up in Iraq, only to have it stolen by a soldier from different camp. Newbee - Adam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top