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.
|||I am trying to learn SQL 2005 and I am working throught the Microsoft SQL Server 2005 Implementation and Maintenance Training Kit.
I have partitoned out my hard-drive into several partitons.
C,G,H,I,J and K.
Created Sales_Data folders in G,H,I drives
I ran the following code in MSSM Studio:
CREATE DATABASE Sales
ON
PRIMARY
(NAME = 'G:\Sales_Data\SalesPrimary.mdf'
SIZE = 50MB,
MAXSIZE = 200,
FILEGROWTH = 20),
FILEGROUP SalesFG
( NAME = SalesData1,
FILENAME = 'H:\Sales_Data\SalesData1.ndf'
SIZE = 200MB,
MAXSIZE = 800,
FILEGROWTH = 100),
( NAME = SalesData2,
FILENAME = 'H:\Sales_Data\SalesData2.ndf'
SIZE = 400MB,
MAXSIZE = 1200,
FILEGROWTH = 300),
FILEGROUP SalesHistoryFG
( NAME = SalesHistory1,
FILENAME = 'H:\Sales_Data\SalesHistory1.ndf'
SIZE = 100MB
MAXSIZE = 500,
FILEGROWTH = 50)
LOG ON
(NAME = ArchLog1,
FILENAME = 'I:\Sales_Data\SalesLog.ldf',
SIZE = 300MB,
MAXSIZE = 800,
FILEGROWTH = 100)
I am getting the following error message:
Msg 153, Level 15, State 1, Line 5
Invalid usage of the option SIZE in the CREATE/ALTER DATABASE statement.
Any idea as to why it will not except the syntax for the size option? ny help will be greatly appreciated.
|||Just do a basic check. You miss comma before SIZE option.CREATE DATABASE Sales
ON
PRIMARY
(NAME = 'G:\Sales_Data\SalesPrimary.mdf', <-Here
SIZE = 50MB,
MAXSIZE = 200,
FILEGROWTH = 20),
FILEGROUP SalesFG
( NAME = SalesData1,
FILENAME = 'H:\Sales_Data\SalesData1.ndf', <-Here
SIZE = 200MB,
MAXSIZE = 800,
FILEGROWTH = 100),
( NAME = SalesData2,
FILENAME = 'H:\Sales_Data\SalesData2.ndf', <--Here
SIZE = 400MB,
MAXSIZE = 1200,
FILEGROWTH = 300),
FILEGROUP SalesHistoryFG
( NAME = SalesHistory1,
FILENAME = 'H:\Sales_Data\SalesHistory1.ndf', <--Here
SIZE = 100MB, <--And here
MAXSIZE = 500,
FILEGROWTH = 50)
LOG ON
(NAME = ArchLog1,
FILENAME = 'I:\Sales_Data\SalesLog.ldf',
SIZE = 300MB,
MAXSIZE = 800,
FILEGROWTH = 100)
Thanks,
Zuomin
No comments:
Post a Comment