Alias CTE like tables
When referencing a CTE, the CTE name is also its alias instead of the shortened version. E.g. the CTE NewUsers doesn't get aliased as "nu". Also, when typing "SELECT * FROM NewUsers", navigating to the "*" and hitting tab to expand columns, the expanded column names aren't prefixed with an alias or table name. This could just be a settings issue
Could you please describe it in more detail and provide us the scripts?
Screenshots would be also of help.
-
par20pinspot commented
In the below query, when you type "SELECT * FROM NewU" and hit tab or whatever key to utilize the code completion on NewUsers, "NewUsers" is not automatically aliased like it would be if NewUsers was an actual table. It should become "SELECT * FROM NewUsers AS nu" according to my settings for table aliasing. The column name prefix issue on "*" expansion appears to be resolved though.
WITH NewUsers AS (
SELECT
t1.UserID
, t1.UserName
FROM (
VALUES
(1, 'admin')
, (2, 'developer')
, (3, 'visitor')
) t1 (UserID, UserName)
)SELECT * FROM NewUsers