ERROR: ‘INT’ is not a recognized CURSOR option -Sql Server

In this article will demonstrate when we get an error like below and how to resolve it.

Msg 155, Level 15, State 2, Line 1
‘INT’ is not a recognized CURSOR option.

WHEN WE GET THIS ERROR:

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

Below examples reproduce this error:

EXAMPLE 1:

DECLARE Var1 INT

RESULT:

Msg 155, Level 15, State 2, Line 1
‘INT’ is not a recognized CURSOR option.

EXAMPLE 2:

DECLARE Var2 VARCHAR(50)

Msg 155, Level 15, State 2, Line 1
‘VARCHAR’ is not a recognized CURSOR option.

HOW TO SOLVE IT?

To solve this prefix the variable by the @ symbol in variable declaration statement.

So let us see the result of the above two examples if we prefix the variable name by @ symbol in the variable declaration.

EXAMPLE 1:

DECLARE @Var1 INT

RESULT:

Command(s) completed successfully.

EXAMPLE 2:

DECLARE @Var2 VARCHAR(50)

Command(s) completed successfully.

One thought on “ERROR: ‘INT’ is not a recognized CURSOR option -Sql Server

  1. It’s a nice question and answer.

    Please keep publishing such articles.

    Thanks for educating the community and appreciate your volunteer-ship.

    Even though it’s simple but helpful since everybody never encounters everything.

Leave a Reply

Your email address will not be published. Required fields are marked *