Format SQL field qualifiers changed
bogieman
Posts: 5
I am using version 7.0.0.62 with SSMS 11.0.3000.0.
When a table is used at least twice in a query and is aliased only once, the formatting changes the qualifier for all field qualifiers to the alias.
original code
CREATE TABLE #temp1 (a INT, b int)
SELECT #temp1.a
, temp1.a
FROM #temp1
JOIN #temp1 temp1
ON #temp1.a = temp1.a
DROP TABLE #temp1
formatted code
CREATE TABLE #temp1 (a INT, b INT)
SELECT temp1.a
, temp1.a
FROM #temp1
JOIN #temp1 temp1
ON temp1.a = temp1.a
DROP TABLE #temp1
When a table is used at least twice in a query and is aliased only once, the formatting changes the qualifier for all field qualifiers to the alias.
original code
CREATE TABLE #temp1 (a INT, b int)
SELECT #temp1.a
, temp1.a
FROM #temp1
JOIN #temp1 temp1
ON #temp1.a = temp1.a
DROP TABLE #temp1
formatted code
CREATE TABLE #temp1 (a INT, b INT)
SELECT temp1.a
, temp1.a
FROM #temp1
JOIN #temp1 temp1
ON temp1.a = temp1.a
DROP TABLE #temp1
Comments
Thanks for your post - we can recreate this here and we'll look into a fix.
This is caused by the "Qualify object names" format action so for now a workaround is to untick that action under Options->Format->Action. Alternatively, adding an alias to both tables will also work.
Thanks,
Aaron.
Thanks!
Aaron.