microsoft / microsoft/vscode-mssql

[Bug]: Query Results Always Sort Case-Sensitive

Open
#21,408 2 comments 1 reaction 0 assignees View on GitHub
Area - Query Editor Enhancement User-filed
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.

Image

### 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.