Reputation: 3438
Why is SSRS throwing an error stating that there is an incorrect syntax near my less than symbol?
-- ==========================================================
-- Create Stored Procedure Template for SQL Azure Database
-- ==========================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Campos,,Adrian>
-- Create date: <7/9/2014,,>
-- Description: <Query is meant to purge records in ONP_IL_MAYWOOD that are older than 3 months.,,>
-- =============================================
CREATE PROCEDURE <Purge_Overnight_3Months, sysname, Purge_Overnight_3Months>
-- Add the parameters for the stored procedure here
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
DELETE FROM tblOverNightPermissions WHERE DateAndTime < DATEADD(month, -3, GETDATE());
END
GO
Error:
Msg 102, Level 15, State 1, Line 6
Incorrect syntax near '<'.
Upvotes: 0
Views: 2521
Reputation: 32697
The <Purge_Overnight_3Months, sysname, Purge_Overnight_3Months>
is a template parameter for Management Studio. While the file is opened in SSMS hit Ctrl-Shift-M (or choose "Specify Values for Template Parameters…" from the Query Menu). This should bring up a grid that says that there's parameter called Purge_Overnight_3Months (the first value in the angle brackets) with a datatype of sysname and a default value of "Purge_Overnight_3Months" (the third value in the angle brackets). Once you specify a value, and hit "ok", it will replace the entire angle brackets with the value that you chose.
Upvotes: 1
Reputation: 204766
Use []
to escape names in TSQL, not <>
CREATE PROCEDURE [Purge_Overnight_3Months, sysname, Purge_Overnight_3Months]
but you should not use such strange names anyway. How about
CREATE PROCEDURE Purge_Overnight_3Months
Upvotes: 0