• In effect they are the same as you stated. However you will never have a situation where you mistakenly forget to put "Local" on your declaration and end up with a global cursor and all of a sudden have a problem like Lars did above. I also find it easier to read the syntax as I'm so used to seeing my variables preceeded with the @ symbol.

    I've been using the Local Variable syntax since SQL 7 first came out. At the time I was doing a lot of research into the differences between 6.5 and 7. This was one of the recommended changes at the time. I've never looked back and just do it that way by habit now.

    The way I see it is that anytime you can, you should limit your variables scope. The local variable syntax is one way to ensure that you have limited the scope of a cursor.




    Gary Johnson
    Microsoft Natural Language Group
    DBA, Sr. DB Engineer

    This posting is provided "AS IS" with no warranties, and confers no rights. The opinions expressed in this post are my own and may not reflect that of my employer.