Azure Data Studio slash star inside slash star not working properly

Gabriel Lafreniere 61 Reputation points
2022-10-25T01:10:46.31+00:00

Hi, I have code from SSMS and read it using Azure Data Studio and had some codes within "/" "/" and seems like text doesn't properly comment if used within it again as such
/*
SELECT t.ID, t.Name, p.Prop
FROM TableName t
/INNER JOIN SomeTable p ON t.Name = p.Name/
GROUP BY t.Name -- All this will not be in commented text visualy
*/

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,363 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,601 questions
{count} votes

3 answers

Sort by: Most helpful
  1. NikoXu-msft 1,911 Reputation points
    2022-10-25T02:52:34.387+00:00

    Hi @Gabriel Lafreniere ,

    /INNER JOIN SomeTable p ON t.Name = p.Name/

    If you commented this sentence, then your SQL statement is going to be problematic because you commented out the alias of the SomeTable table, and the select statement does not recognize the fields of the table.

    Best regards
    Niko

    0 comments No comments

  2. Viorel 114.7K Reputation points
    2022-10-25T09:16:35.053+00:00

    It seems that your version of Azure Data Studio does not colorise the nested comments correctly. Such comments are valid in SQL. No errors will be reported for your commented query in both of Management Studio and Azure Data Studio:

    /*  
    SELECT t.ID, t.Name, p.Prop  
    FROM TableName t  
    /*INNER JOIN SomeTable p ON t.Name = p.Name*/  
    GROUP BY t.Name -- All this will not be in commented text visualy  
    */  
    

    (This forum seems to have a similar problem).

    See the reported issue: https://github.com/microsoft/azuredatastudio/issues/19205. It seems to be fixed, but not distributed yet.

    If you observe other issues, you can use the "Report Issue" command from Help menu, or the GitHub pages.

    0 comments No comments

  3. Erland Sommarskog 107.2K Reputation points
    2022-10-25T21:49:19.377+00:00

    Indeed, this seems to be an imperfection in Azure Data Studio. You can report bugs here: https://feedback.azure.com/d365community/forum/04fe6ee0-3b25-ec11-b6e6-000d3a4f0da0.

    As for that happened with your original post: The posting window is not WYSIWIG, but uses Markdown which is a lightweight markup language. It is so lightweight that it takes a while to notice... Anyway, in markdown asterisks are used to mark that text should be in italics.

    To insert code, you can use the button with ones and zeroes. (Or simply intend it with four spaces.)

    0 comments No comments