Click here to Skip to main content
15,946,012 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have faced an issue with Database naming convention.

I hav two Database named "MyDatabase" and "3MyDatabase" (Starting with number).

I want to alter Database by below code.

ALTER DATABASE MyDatabase SET OFFLINE WITH ROLLBACK IMMEDIATE (Its working properly as DB name is MyDatabase)

ALTER DATABASE 3MyDatabase SET OFFLINE WITH ROLLBACK IMMEDIATE (showing error as DB name is 3MyDatabase, starting with number )

I am facing this issue when Database name is starting with number.
If Database contains number but it does not start with number then no issue.

Please help. How to execute above script if Database name starts with number.

Thanks,
Praveen
Posted
Updated 16-Jun-13 18:20pm
v2
Comments
CHill60 15-Jun-13 10:06am    
Try surrounding the name with square brackets []

1 solution

Your naming convenstion must comply with the rules of Database Identifiers[^]

You can try this:
SQL
ALTER DATABASE [3MyDatabase] SET OFFLINE WITH ROLLBACK IMMEDIATE



--Amit
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900