I'm using Windows 7 (x64) and I have an auto generated script for creating a SQL Server Express 2012 database.
The script starts as follows:
USE [master]
GO
CREATE DATABASE [Example]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'Example', FILENAME = N'D:\Example.mdf' , SIZE = 4544KB ,
MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'Example_log', FILENAME = N'D:\Example_log.ldf' , SIZE = 3136KB ,
MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
ALTER DATABASE [Example] SET COMPATIBILITY_LEVEL = 100
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [Example].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
...
The script first error is
Msg 102, Level 15, State 1, Line 3
Incorrect syntax near 'CONTAINMENT'.
The idea is to pass a database from one server to the other with different SQL Server 2012 versions. I wanted to keep the scripts in case I needed to create the DB somewhere else.
Why does the automatically generated script cause this error?
Get rid of the CONTAINMENT = NONE
It is the default so you don't need it and SQL Server Express seems to choke on it.