创建存储过程SQL Server Express时出错

flseospp  于 2022-11-28  发布在  SQL Server
关注(0)|答案(1)|浏览(157)

我特灵创建存储过程以在SQL Server Express中执行备份,但收到以下消息:
“BACKUP”附近有语法错误。应为“(”或SELECT
这是我的代码:

USE [xxxxdb]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE xxxx 
AS
(BACKUP DATABASE xxxdb TO DISK='D:\BackUPs\xxxx.bak' with init,stats=10);
GO
GO

我做错了什么?谢谢大家!

g2ieeal7

g2ieeal71#

去掉不必要的括号

CREATE PROCEDURE xxxx 
AS
BACKUP DATABASE xxxdb TO DISK='D:\BackUPs\xxxx.bak' with init,stats=10;

相关问题