Skip to content
Advertisement

Update a Table Variable Where Not Exists

Where @Customer is a TABLE variable:

On the last line, I get

Must declare scalar variable @Customer

Advertisement

Answer

You need a table alias:

SQL Server automatically interprets anything that starts with a @ as a variable (of some sort). Table aliases are a different thing, so it doesn’t find a match.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement