我认为执行此操作的方法是转到 SSMS 中的现有数据库(Sql Server 16.0.1105.1 开发人员版)并运行 Tasks | 生成脚本...
这包括一个 FullTextTable。所以我得到了以下脚本(仅显示开始):
USE [master]
GO
/****** Object: Database [LouisHowe] Script Date: 11/15/2023 5:56:31 PM ******/
CREATE DATABASE [LouisHowe]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'LouisHowe', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\LouisHowe.mdf' , SIZE = 73728KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB )
LOG ON
( NAME = N'LouisHowe_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\LouisHowe_log.ldf' , SIZE = 8192KB , MAXSIZE = 2048GB , FILEGROWTH = 65536KB )
WITH CATALOG_COLLATION = DATABASE_DEFAULT, LEDGER = OFF
GO
ALTER DATABASE [LouisHowe] SET COMPATIBILITY_LEVEL = 160
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [LouisHowe].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [LouisHowe] SET ANSI_NULL_DEFAULT OFF
看来数据库已经创建好了。但我收到了近 200 条错误消息(仅显示前几条):
Msg 40508, Level 16, State 1, Line 1
USE statement is not supported to switch between databases. Use a new connection to connect to a different database.
Msg 102, Level 15, State 1, Line 6
Incorrect syntax near 'ON'.
Msg 319, Level 15, State 1, Line 10
Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.
Msg 5011, Level 14, State 5, Line 12
User does not have permission to alter database 'LouisHowe', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 12
ALTER DATABASE statement failed.
我需要做什么来修复脚本?