Why I get error when I try to create stored procedure?

Michael

I use MSSQL-server 2012.

I create stored procedure:

CREATE PROCEDURE [dbo].[SaveEcxelReport]

 @siteNum INT = NULL,
 @dateReport DATETIME = NULL,
 @siteName NVARCHAR = NULL,
 @prog1 INT = NULL,
 @progLayout1 INT = NULL,
 @prog2 INT = NULL,
 @progLayout2 INT = NULL,
 @isLOZ BIT = NULL,
 @start DATETIME = NULL,
 @end DATETIME = NULL,
 @time DATETIME = NULL,
 @Prog1ToProg2Check REAL = NULL,
 @comment NVARCHAR = NULL

AS   
BEGIN
  SET NOCOUNT ON;
  insert into dbo.ReportTrafficDepartment(siteNum, dateReport, siteName, prog1, progLayout1, prog2, progLayout2, isLOZ, start, end, time, Prog1ToProg2Check, comment) 
         values (@siteNum,@dateReport,@siteName,@prog1,@progLayout1, @prog2,@progLayout2,@isLOZ,@start,@end,@time,@Prog1ToProg2Check,@comment) 
END

In stored procedurte in this row:

dbo.ReportTrafficDepartment(siteNum, dateReport, siteName, prog1, progLayout1, prog2, progLayout2, isLOZ, start, end, time, Prog1ToProg2Check, comment)

I get error on this word:

end

The text of the error is:

Msg 156, Level 15, State 1, Procedure SaveEcxelReport, Line 28

Incorrect syntax near the keyword 'end'.

Any idea why I get error above and how to fix it?

Kumar_Vikas

end is a SQL keyword. So wrap the column name with brackets, similar to this [end]. start and time also belong to the same family. wrapping column names with brackets will indicate that this is not a keyword.

CREATE PROCEDURE [dbo].[SaveEcxelReport]

 @siteNum INT = NULL,
 @dateReport DATETIME = NULL,
 @siteName NVARCHAR = NULL,
 @prog1 INT = NULL,
 @progLayout1 INT = NULL,
 @prog2 INT = NULL,
 @progLayout2 INT = NULL,
 @isLOZ BIT = NULL,
 @start DATETIME = NULL,
 @end DATETIME = NULL,
 @time DATETIME = NULL,
 @Prog1ToProg2Check REAL = NULL,
 @comment NVARCHAR = NULL

AS   
BEGIN
  SET NOCOUNT ON;
  insert into dbo.ReportTrafficDepartment(siteNum, dateReport, siteName, prog1, progLayout1, prog2, progLayout2, isLOZ, [start], [end], [time], Prog1ToProg2Check, comment) 
         values (@siteNum,@dateReport,@siteName,@prog1,@progLayout1, @prog2,@progLayout2,@isLOZ,@start,@end,@time,@Prog1ToProg2Check,@comment) 
END

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Why I get -1 from stored procedure?

When i try to create react project i get error

Why I get error when I try to declare local variable?

Why do I get an error for "__CrtGetFileInformationByHandleEx " when I try to compile

Why I get error when I try to install pyaudio?

Why I get an error when I try to upload a picture

How to solve this error "ERROR 102 sql state 420000" which comes up when I try to create this procedure

Getting a ORA-00933: SQL command not properly ended error when I try to run an Oracle stored procedure that I wrote

Why I get error when try append element to document?

Why do I get error when try to convert Carbon to DateTime?

Why I get error when try build image in docker?

I get an error when executing a stored procedure in MySQL (Error Code: 1054)

I get this error when I try to install

sql server 2014 Why do I get the error with the code in a view and not stored procedure

Why can't I create a MySQL stored procedure in PHP?

In a stored procedure when I'm passing a date parameter, I get an error "conversion failed when converting date from character string"

Why do I get an error when create a function but not when a variable?

Why Do I get an error when I try to get tkinter slider value?

Why I obtain these error messages when I try to install gem bundler on Ubuntu? (Could not create Makefile)

Why I obtain these error messages when I try to install gem bundler on Ubuntu? (Could not create Makefile)

Why I obtain these error messages when I try to install gem bundler on Ubuntu? (Could not create Makefile)

Why is there an error when I try to create a constructor for a class I have made?

Why i am getting a not found error when i try to create a new file with octokitnet?

Why am I getting an error when I try to create the Scoreboard object with an array?

why is it when I try to create a child class from a parent class(Downcasting), I get a null object

I am trying Try and Catch Error handling for snowflake stored procedure. in the Stored procedure there are four different statements s

React App: Why I get an error when I try to run npm start script?

Why do I get a NoClassDefFound error when I try to save my test plan?

Why do I get error when I try to alert the length of the passed array to the function?

TOP Ranking

HotTag

Archive