Skip to content

[Bug]: Valid openrowset query shows error in the editor #20839

@llali

Description

@llali

Description

Valid query shows red lines with error message:
Query:
CREATE VIEW [dbo].[test2] AS
SELECT
*
FROM
OPENROWSET(
'CosmosDB',
'Account=your-cosmosdb;Database=covid;Key=yourcosmosdbkey',
Cord19
) WITH ( title varchar(1000) '$.metadata.title',
authors varchar(max) '$.metadata.authors' ) AS docs
CROSS APPLY OPENJSON ( authors )
WITH (
first varchar(50),
last varchar(50),
affiliation nvarchar(max) as json
) AS a-- Write your own SQL object definition here, and it'll be included in your package.

Error: Incorrect syntax: 'CREATE VIEW' must be the only statement in the batch.

Steps to Reproduce

1- Open a new Query
2- Paste the following query which is valid in SQL Server 2025
CREATE VIEW [dbo].[test2] AS
SELECT
*
FROM
OPENROWSET(
'CosmosDB',
'Account=your-cosmosdb;Database=covid;Key=yourcosmosdbkey',
Cord19
) WITH ( title varchar(1000) '$.metadata.title',
authors varchar(max) '$.metadata.authors' ) AS docs
CROSS APPLY OPENJSON ( authors )
WITH (
first varchar(50),
last varchar(50),
affiliation nvarchar(max) as json
) AS a-- Write your own SQL object definition here, and it'll be included in your package.

  • Expected: Shouldn't show any error
  • Actual:
Image

Affected Area

  • Connection dialog (SQL Server | Azure browse/Fabric browse)
  • Query editor
  • 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

Version: 1.106.3 (user setup)
Commit: bf9252a2fb45be6893dd8870c0bf37e2e1766d61
Date: 2025-11-25T22:28:18.024Z
Electron: 37.7.0
ElectronBuildId: 12781156
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Windows_NT x64 10.0.26100
mssql: 1.38

Confirmation

  • I have searched existing issues and couldn't find a match
  • I want to work on this issue

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions