1> SELECT name from sys.databases
2> Go
name
--
master
tempdb
model
msdb
1> CREATE DATABASE [AdventureWorks] ON
2> (AdventureWorks = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
< AdventureWorks>.mdf' ),
3> (AdventureWorks = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
< AdventureWorks>.ldf' )
4> FOR ATTACH ;
5> GO
Msg 153, Level 15, State 1, Server YOUR-V7OY5L24PG\SQLEXPRESS, Line 2
Invalid usage of the option AdventureWorks in the CREATE/ALTER DATABASE statemen
t.
1> USE [master]
2> GO
Changed database context to 'master'.
1> CREATE DATABASE [AdventureWorks] ON
2> (AdventureWorks = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
< AdventureWorks>.mdf' ),
3> (AdventureWorks = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
< AdventureWorks>.ldf' )
4> FOR ATTACH ;
5> GO
Msg 153, Level 15, State 1, Server YOUR-V7OY5L24PG\SQLEXPRESS, Line 2
Invalid usage of the option AdventureWorks in the CREATE/ALTER DATABASE statemen
t.
1> select name from sys.databases
2> go
name
--
master
tempdb
model
msdb
(4 rows affected)
1>
Your create database statement is slightly wrong. If you look at the syntax it is
create database <dbname> ON (Name=<logical name for file>, filename='<filename>')
LOG ON (Name=<logical name for file>, filename='<filename>')
You have combined the logical name for file and filename and ommitted the name and filename keywords.
No comments:
Post a Comment