I tring to create a stored procedure to do Backup in SQL Server Express, and i received this message:
Incorrect syntax near 'BACKUP'. Expecting '(' or SELECT
This is my code:
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
What i'm doing wrong? Thanks everybody!
CodePudding user response:
Just remove the unecessary parenthesis
CREATE PROCEDURE xxxx
AS
BACKUP DATABASE xxxdb TO DISK='D:\BackUPs\xxxx.bak' with init,stats=10;