Bug / AS

Hi Team,


; WITH
duplicates_cte AS
(
SELECT
*
  , HASHBYTES (
  'MD5'
, CONCAT (
TRIM ('_.|' FROM requestId)
   ,  eventTime
)
  ) AS hashId
  FROM sys.objects
  )
  SELECT * FROM duplicates_cte;

SQL Prompt will add an AS before evenTime and the code becomes invalid.
Thanks for fixing!

Torsten
MVP 

Answers

  • Dan_JDan_J Posts: 465 Silver 2
    H @torsten.strauss

    Thanks for reaching out to us regarding this!

    So far I've not been able to reproduce this. I have your Style file from when you have previously provided it and applied it to the code example you have given but there is no AS added before eventTime.

    Would you mind providing a screenshot showing how this looks from your side? Also, are you using your 'My Style' style file when formatting this code?
    Kind regards

    Dan Jary | Redgate Software
    Have you visited our Help Center?
  • torsten.strausstorsten.strauss Posts: 271 Silver 3
    Hi Dan!

    Yes, I am using the style sheet attached in one of my latest threads. I attached the screenshots and hope this helps you to resolve the issue.
    Thanks!




  • torsten.strausstorsten.strauss Posts: 271 Silver 3
    I guess I find the setting which causes the error. Since this option works well for tables and views in general, I assume it is a bug.




  • Dan_JDan_J Posts: 465 Silver 2
    Hi @torsten.strauss

    Thanks for the additional information regarding this.

    For some reason I still cannot replicate this behavior. I have the AS keyword style option enabled and your Style file selected as my active style. When I 'Format SQL' is formats the code as follows and does not input AS before eventTime:



    My apology for this, is there anything I'm missing here? 
    Kind regards

    Dan Jary | Redgate Software
    Have you visited our Help Center?
  • torsten.strausstorsten.strauss Posts: 271 Silver 3
    Hm, interesting. If I format the code it will fail since SQL prompt will add an AS.
    If you like we can have a teams session, or I can send you additional log files (if any).
  • PerSPerS Posts: 3 New member
    @torsten.strauss, I get the same buggy behavior with the added AS when I'm connected to Azure Synapse, but not when connected to a local SQL Server database. Is this the case with you as well?

    I have experienced this and other bugs when working with Synapse.
  • torsten.strausstorsten.strauss Posts: 271 Silver 3
    Hi PerS,

    in this case it is a SQL Database not Synapse but I guess it is the same root cause ...
  • Dan_JDan_J Posts: 465 Silver 2
    Hi @torsten.strauss

    My apology for the delay in coming back to you on this.

    I have tried to reproduce this again but still do not see the same behaviour you and @PerSare seeing. After checking with our team here, we do not currently support Synapse, however that isn't applicable for @torsten.strauss.

    I'd be happy to arrange a screen share session, however I am due to be out of the office next week. Do you have any availability on the 8th June to discuss this? Also, what time zone are you located in?





    Kind regards

    Dan Jary | Redgate Software
    Have you visited our Help Center?
  • torsten.strausstorsten.strauss Posts: 271 Silver 3
    Hi Dan,

    I am sure we will find time for a short session on June 8!
    Enjoy your week off!
  • torsten.strausstorsten.strauss Posts: 271 Silver 3
    BTW. If we have the session I will show another big issue with the SQL Prompt snippets ....
  • Dan_JDan_J Posts: 465 Silver 2
    Hi @torsten.strauss

    My sincere apology, I hadn't appreciated how busy I was going to be following my return to work! Do you mind if I schedule something in for us to speak on Friday 10th instead? Also, what time zone are you located in?
    Kind regards

    Dan Jary | Redgate Software
    Have you visited our Help Center?
  • Hi Dan!
    Sorry but I had to deliver a session at SQL Start 2022 last Friday but I have some time this week...
  • Dan_JDan_J Posts: 465 Silver 2
    Hi Torsten!

    No problem at all, I hope the session went well! I'm sorry that I'm also only just getting back to you!

    Are you free tomorrow (Friday) morning at 11am BST? 
    Kind regards

    Dan Jary | Redgate Software
    Have you visited our Help Center?
  • Hi Dan,

    this Friday I am free at 11am BST.
  • Dan_JDan_J Posts: 465 Silver 2
    Hi @torsten.strauss

    Thanks for coming back to me on this.

    Sure, Friday at 11am BST will work for me. I'll book that in now and send over the meeting details. 
    Kind regards

    Dan Jary | Redgate Software
    Have you visited our Help Center?
Sign In or Register to comment.