microsoft / microsoft/vscode-mssql
[Bug]: Query Results Always Sort Case-Sensitive
- Dominant language
- TypeScript
- Stars
- 1.9k
- Forks
- 610
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 97
Description
### Description
Expected the MSSQL extension to either sort case-insensitive, or to match the collation sort of the database.
But what actually happens is that it always sorts case-sensitive.
### Steps to Reproduce
1. Run this query in a case-insensitive database.
```tsql
SELECT CONVERT (varchar(256), SERVERPROPERTY('collation'));
DECLARE @SortingExample TABLE
(
String VARCHAR(50) NOT NULL
)
INSERT INTO @SortingExample
(String)
VALUES
('apple'),
('Banana'),
('grape'),
('Kiwi'),
('orange'),
('Pineapple'),
('strawberry'),
('Watermelon')
SELECT String
FROM @SortingExample
```
2. The results are shown (including current DB collation).
3. Click the sort button in the header of the `String` column.
4. Observe that the values are sorted case-sensitive.
### Affected Area
- [ ] Connection dialog (SQL Server | Azure browse/Fabric browse)
- [ ] Query editor
- [x] Query results panel
- [ ] Object Explorer
- [ ] GitHub Copilot integration
- [ ] Preview/Edit data
- [ ] Table Designer
- [ ] Schema Designer
- [ ] Schema Compare
- [ ] Local SQL Server Container provisioning
- [ ] SQL database in Fabric provisioning
- [ ] DACPAC/BACPAC export/import
- [ ] SQL Database projects
- [ ] Query Plan Visualizer
- [ ] Other (please describe below)
### If you selected "Other", please describe the affected area
_No response_
### Environment Information
* VS Code Version: 1.109.5
* MSSQL Extension Version: 1.40.0
* Operating System: Windows 11 Enterprise, v 25H2
* Connection Type: Azure SQL Managed Instance, connected via Microsoft Entra ID - Universal with MFA support
### Confirmation
- [x] I have searched existing issues and couldn't find a match
- [ ] I want to work on this issue
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the case-insensitive MSSQL query in the query results panel and compare the database's collation with the column sort behavior. Trace the query results sorting entry point and determine how sorting should respect the database collation or compare values case-insensitively. Done means the String column sorts as expected for a case-insensitive database, with coverage for the reported example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql, typescript
- Domain
- database, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100