What are the challenges you face when working across database platforms? Take the survey

Bug found in SQL Prompt

Here are the repro steps.
In a query window that has AdventureWorks2012 as the active DB (probably works in other AW versions too), paste the following code:
SELECT sod.SalesOrderID,
      (SELECT soh.OrderDate
       FROM Sales.SalesOrderHeader AS soh
       WHERE soh.SalesOrderNumber = 'SO' + CAST(sod.SalesOrderID AS varchar(10))
       GROUP BY)
FROM Sales.SalesOrderDetail AS sod
WHERE sod.OrderQty = 12;
Position the cursor directly after BY, before the closing parenthesis. Type a single space; this should bring up a list of auto-complete options. The first one is "All non-aggregated columns" (an option which I absolutely love, BTW, except in this specific case). Select it.
It should enter "soh.OrderDate" at the cursor position. Instead, it REPLACES the entire subquery with "soh.OrderDate".

Tried several times, reproduces consistently. SSMS 17.3, SQL Prompt
Hugo Kornelis
(SQL Server MVP, 2006-2016 + 2019-now // Friend of Red Gate)


Sign In or Register to comment.