Thursday, March 29, 2012

database naming

Hello Group,
where does it talk about naming databases in the books online? I thought
that a database name could not have a dash "-" in the name?
Rich
The topic is "Identifiers"
http://msdn2.microsoft.com/en-us/library/ms175874(SQL.90).aspx .See the
section "Rules for Regular Identifiers".
The only way you can includ special characters like a dash is to delimit the
name with [ ] or qoutes. See the topic "Delimited Identifiers" for more
details.
-- This fails
create database my-database
-- This works
create database [my-database]
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
"Rich" <Rich@.discussions.microsoft.com> wrote in message
news:52512AC5-DADA-4C44-83AB-D9C5A635A7B9@.microsoft.com...
> Hello Group,
> where does it talk about naming databases in the books online? I thought
> that a database name could not have a dash "-" in the name?
> Rich
|||Hello Gail,
here is the command I am running in the QA:
backup log intrel-dev with truncate_only
and the error I get:
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '-'.
I suspect that the database name cannot have the dash in it.
Rich
"Gail Erickson [MS]" wrote:

> The topic is "Identifiers"
> http://msdn2.microsoft.com/en-us/library/ms175874(SQL.90).aspx .See the
> section "Rules for Regular Identifiers".
> The only way you can includ special characters like a dash is to delimit the
> name with [ ] or qoutes. See the topic "Delimited Identifiers" for more
> details.
> -- This fails
> create database my-database
> -- This works
> create database [my-database]
> --
> Gail Erickson [MS]
> SQL Server Documentation Team
> This posting is provided "AS IS" with no warranties, and confers no rights
> "Rich" <Rich@.discussions.microsoft.com> wrote in message
> news:52512AC5-DADA-4C44-83AB-D9C5A635A7B9@.microsoft.com...
>
>
|||Did you try delimiting the name with [ ] or qoutes? As in, backup log
[intrel-dev] with truncate_only
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
"Rich" <Rich@.discussions.microsoft.com> wrote in message
news:059836F7-2E73-4340-BC3C-3FE3E4B3AC7D@.microsoft.com...[vbcol=seagreen]
> Hello Gail,
> here is the command I am running in the QA:
> backup log intrel-dev with truncate_only
> and the error I get:
> Server: Msg 170, Level 15, State 1, Line 1
> Line 1: Incorrect syntax near '-'.
> I suspect that the database name cannot have the dash in it.
> Rich
> "Gail Erickson [MS]" wrote:

No comments:

Post a Comment