Formatting problem
ChrisYoung
Posts: 5 Bronze 1
in SQL Prompt
Hi,
I have encountered a problem when formatting code that uses AT TIME ZONE.
When I format code like this:
I have encountered a problem when formatting code that uses AT TIME ZONE.
When I format code like this:
SELECT CAST(X.CreatedDate AT TIME ZONE 'UTC' AT TIME ZONE X.TimeZone AS datetime) AS CreatedDate
FROM (SELECT GETUTCDATE() AS CreatedDate, 'E. Australia Standard Time' AS TimeZone) X;
SELECT CAST(((X.CreatedDate AT TIME ZONE 'utc' ) AT TIME ZONE X.TimeZone) AS datetime) AS CreatedDate
FROM (SELECT GETUTCDATE() AS CreatedDate, 'E. Australia Standard Time' AS TimeZone) X;
The result is this, where the column alias is qualified with the table alias X :
The result is this, where the column alias is qualified with the table alias X :
SELECT CAST(((X.CreatedDate AT TIME ZONE 'utc' ) AT TIME ZONE X.TimeZone) AS datetime) AS X.CreatedDate
FROM (SELECT GETUTCDATE() AS CreatedDate, 'E. Australia Standard Time' AS TimeZone) X;
When using a different column alias, the problem does not occur.
Thanks.
Chris.
When using a different column alias, the problem does not occur.
Thanks.
Chris.
Tagged:
Answers
Could you confirm which version of SSMS and SQL Prompt you are currently using?
Best,
Dustin
I'm using SSMS 18.11.1 and SQL Prompt 10.12.1.28146.
We were able to reproduce the formatting problem as described.
We have escalated this to our dev team for further investigation and will follow up once more information has been made available.
Best,
Dustin
Would you be able to update to the most recent version of SQL Prompt v10.12.3 and see if the issue is still occurring?
Best,
Dustin
I have updated to the latest version but it did not resolve the problem.
Regards,
Chris
Thank you for checking that, we may need more information on this one since we can no longer replicate this scenario on our end and will be reaching out via email.
Best,
Dustin