qualify object names and table variables

AlexSlaterAlexSlater Posts: 4
edited August 26, 2008 11:35AM in SQL Refactor Previous Versions
The `qualify object names` doesn't seem to work on SQL containing table variables.

Here's a little example. This code

declare @tabvar TABLE (cola INT, colb INT)
select * from @tabvar
where cola = 1 and colb = 2

runs satisfactorily.

But when you `qualify object names` on it, it becomes:

declare @tabvar TABLE ( cola INT, colb INT )
select *
from @tabvar
where [@tabvar].[cola] = 1
and [@tabvar].[colb] = 2


which doesn't work.

Msg 107, Level 16, State 2, Line 3
The column prefix '@tabvar' does not match with a table name or alias name used in the query.
Msg 107, Level 16, State 2, Line 3
The column prefix '@tabvar' does not match with a table name or alias name used in the query.



I'm using sql server 2005 management studio on a sql server 2000 database.

Comments

  • Thanks for letting us know about this. I was able to recreate it easily using your example and have logged it in our bug tracking software. the developers will look into this when they next work on SQL Refactor.
Sign In or Register to comment.