Competition: What’s your favorite Redgate tool? Enter now.

Format SQL field qualifiers changed

bogiemanbogieman Posts: 5
edited October 2, 2015 9:56AM in SQL Prompt
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

Comments

Sign In or Register to comment.