我遇到了一个问题,我试图在 linux 服务器上恢复 php 中的 MSSQL 转储。我正在读取文件,然后将文件作为查询传递。
这有效:
CREATE TABLE [dbo].[recipes](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Title] [nvarchar](500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Desc] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Directions] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CompAuthor] [nvarchar](500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CompName] [nvarchar](500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Servings] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
CONSTRAINT [PK_recipes] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
)
但是只要我添加一个像 GO 这样的词
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
)
GO
它抛出一个错误,如
Warning: mssql_query(): message: Incorrect syntax near 'GO'
我的问题是导致此错误的原因以及如何解决?