Variable names in stored procedures

  • Hello, I have a problem with SQL Server 2005 (90), it has IDENTIFIER_CASE="MIXED" and COLLATION_SEQ="charset=iso_1 collation=Modern_Spanish_CI_AS".

    It used to work fine, but a week ago it began to give error "variable names must be unique within a query batch ...". The procedure has declared the variables

    * @Pas_A numeric(15,2)

    * @PAS_A numeric(15,2)

    * @Act_A numeric(15,2)

    * @ACT_A numeric(15,2)

    I am stucked, any help would be great, thanks in advance. :crying:

  • anaherde (6/30/2010)


    Hello, I have a problem with SQL Server 2005 (90), it has IDENTIFIER_CASE="MIXED" and COLLATION_SEQ="charset=iso_1 collation=Modern_Spanish_CI_AS".

    It used to work fine, but a week ago it began to give error "variable names must be unique within a query batch ...". The procedure has declared the variables

    * @Pas_A numeric(15,2)

    * @PAS_A numeric(15,2)

    * @Act_A numeric(15,2)

    * @ACT_A numeric(15,2)

    I am stucked, any help would be great, thanks in advance. :crying:

    It's just an absolutely horrible idea to have it be case sensitive. Why in the world would you want to have "@Pas_A" and "@PAS_A" refer to separate variables?

    └> bt



    Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • If I remember it right IDENTIFIER_CASE property refers to names of Tables, Columns and Procedures therefore SQL Server is doing what is expected to do erroring out when a query includes duplicate variable names - same spelling, different case.

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • I just found the project "as it is", there is no documentation and no one knows why it was made this way. The project is visual basic and asp and the funny thing is that it works in production environment, not in development.

    I´ve been asking people who has been working here for ages and they say that it hasn´t been modified since last year and the only changes they have made were for keeping the application working (testing different options) and again with no documentation.

    I think I´m quitting :(, this is too messy.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply