Msg 156,Level 15,State 1,Line 2关键字' ON'附近的语法不正确

时间:2017-07-27 11:56:16

标签: sql-server tsql

//这段代码,我所拥有的和附近的" ON"我看不到不正确的语法

CREATE DATABASE ShopDB
ON
(
NAME = 'ShopDB',
FILENAME = 'C:\Projects\SQL\ShopDB.mdf',
SIZE = 10MB,
MAXSIZE = 100MB,
FILEGROWTH = 10MB
)
LOG ON
(
NAME = 'LogShopDB',
FILENAME = 'C:\Projects\SQL\ShopDB.ldf',
SIZE = 5MB,
MAXSIZE = 50MB,
FILEGROWTH = 5MB
)

1 个答案:

答案 0 :(得分:0)

试试这个

USE [master]
GO

/****** Object:  Database [ShopDB]    Script Date: 7/27/2017 5:42:58 PM ******/
CREATE DATABASE [ShopDB]
 CONTAINMENT = NONE
 ON  PRIMARY 
( NAME = N'ShopDB', 
    FILENAME = N'D:\SqlDatabseFiles\ShopDB.mdf' , 
    SIZE = 4096KB , MAXSIZE = UNLIMITED,
    FILEGROWTH = 1024KB 
)
 LOG ON 
(    NAME = N'ShopDB_log', 
     FILENAME = N'D:\SqlDatabseFiles\ShopDB_log.ldf' , 
     SIZE = 1024KB , 
     MAXSIZE = 2048GB ,
     FILEGROWTH = 10%
)
GO