Saturday, April 13, 2019

'datetime' or 'INT' is not a recognized CURSOR option.


Msg 155, Level 15, State 2, Line 1
'datetime' is not a recognized CURSOR option.


We get an error of this kind when we miss prefixing @ symbol to the variable name during declaration.

Below examples reproduce this error:

if we execute the below statement 
DECLARE intVar INT;

We will end up with below error
Msg 155, Level 15, State 2, Line 1
‘INT’ is not a recognized CURSOR option.

if we execute the below statement 

DECLARE Var2 VARCHAR(50)

We will end up with below error
Msg 155, Level 15, State 2, Line 1
‘VARCHAR’ is not a recognized CURSOR option.

Fix this by adding prefix the variable by the @ symbol in the variable declaration statement.



https://docs.microsoft.com/en-us/sql/relational-databases/databases/database-identifiers?view=sql-server-2017

No comments:

Post a Comment

Recently Executed queries

 SELECT     txt.TEXT AS [SQL Statement],     qs.EXECUTION_COUNT [No. Times Executed],     qs.LAST_EXECUTION_TIME AS [Last Time Executed],   ...