37314

Incorrect syntax near '

Question:

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:

<blockquote>

Msg 102, Level 15, State 1, Line 6<br /> Incorrect syntax near '<'.

</blockquote>

Answer1:

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

Answer2:

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.

Recommend

  • Android google maps v2 execute asynctask when user stops moving the camera
  • Parsing XML file in Perl - Retain sequence
  • Can't remove inline event handler in chrome
  • Parsing Complex JSON file with JQ Issue
  • Restricted profiles settings not being remembered
  • Scala's collect inefficient in Spark?
  • constexpr vs const vs constexpr const
  • Populate ArrayList from Stored Procedure result set
  • Modify chart label orientation with XlsxWriter module (Python)
  • “Complex Header” not responsive in current DataTables.net build?
  • update record in database using jdatabase
  • How do I prepend to a stream in Bash?
  • How to get to older Xcode beta version?
  • jquery full calendar
  • SQL: Getting the physical size of a subset of a table
  • how to populate a SQLite database and use that database in phonegap?
  • How do I remove all but some records based on a threshold?
  • How do I get the list of bad records that didn't load in Bigquery?
  • calculate gradient output for Theta update rule
  • Sequential (transactional) API calls in angular 4 with state management
  • Array with custom indexes in Ionic2
  • How can the INSERT … ON CONFLICT (id) DO UPDATE… syntax be used with a sequence ID?
  • QLPreviewController hide print button in ios6
  • Row Count Is Returning the incorrect number using RaptureXML
  • R - Combining Columns to String Based on Logical Match
  • Illegal mix of collations for operation for date/time comparison
  • Getting last autonumber in access
  • Uncaught Error: Could not find module `ember-load-initializers`
  • Is there a amazon webstore API for customers?
  • Release, debug version and Authorization Google?
  • Do create extension work in single-user mode in postgres?
  • Comma separated Values
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • Error creating VM instance in Google Compute Engine
  • Hits per day in Google Big Query
  • how does django model after text[] in postgresql [duplicate]
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?