Home Forums Programming General Error 137 - you must declare the scalar variable RE: Error 137 - you must declare the scalar variable

  • dokledon (8/2/2013)


    Hi,

    I'm running a script against 16 registered servers (6 SQL 2000, 4 SQL 2005, 6 SQL 2008R2) within the same connection.

    It works well, except for 2 of 6 the SQL 2008R2.

    I receive the error: Error 137 - you must declare the scalar variable.

    The script starts like that:

    Declare @datefull datetime

    Declare @datelog datetime

    Set @datefull = '01/05/13 23:12:00.500'

    Set @datelog = '28/09/13 14:05:23.100'

    Select .....

    From ....

    GO

    I can't understand why those 2 SQL 2008R2 return this error, as it is the same script for all registered servers.

    Could it be an Instance configuration ?

    Thanks,

    Dok

    You could also doublecheck that these two servers don't have one of those "case sensitive" collations. If it had a case sensitive collation and you aren't consistant with your naming of variables (the declaration has all lowercase and subsequent use of that variable maybe has an uppercase spelling), this could lead to these specific servers complaining while others successfully run.

    Just a possibility you might want to eliminate!