Local Variables Declared Repeatedly

I ran into some unexpected behavior with local variables that I think should be pointed out. Normally, local variables can only be declared once in a query. For example, this code: produces this error: Msg 134, Level 15, State 1, Line 2 The variable name ‘@TestInt’ has already been declared. Variable names must be unique […]