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

  • Aaron LAaron L Posts: 596 New member
    Hi bogieman,

    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.
  • Aaron LAaron L Posts: 596 New member
    I think we've got a fix in this private build. Could you please give it a try and let us know if it works for you?

    Thanks!
    Aaron.
Sign In or Register to comment.