Options

Format bug for temp table alias

ByronBartonByronBarton Posts: 1 New member
edited September 27, 2018 5:34PM in SQL Prompt
Using SQL Prompt v9.3.0.6627, try formatting this and you'll see that Format drops the reference #my_tb on the JOIN clause, leaving the column as ambiguous and thereby fails SQL parsing:

CREATE TABLE #my_tb (database_id int)

INSERT INTO #my_tb  VALUES (1), (2), (3), (4)

SELECT * 
FROM #my_tb
JOIN sys.databases db ON db.database_id = #my_tb.database_id

The work-around is to provide an alias for #my_tb, but that shouldn't be necessary.
Thanks.

Sign In or Register to comment.