Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stripping the batch separator 'GO' #1385

Open
1 of 5 tasks
neospud1 opened this issue Oct 9, 2024 · 0 comments
Open
1 of 5 tasks

Stripping the batch separator 'GO' #1385

neospud1 opened this issue Oct 9, 2024 · 0 comments
Labels

Comments

@neospud1
Copy link

neospud1 commented Oct 9, 2024

Describe the bug
When I run my sql file, I get the error "'CREATE/ALTER PROCEDURE' must be the first statement in a query batch.". In the query history, I can see multiple entries were added based on my use of ; at the end of a query. There are no batch separators in the query history 'GO'. The file runs fine in other editors such as Azure Data Studio for example.

To Reproduce
Steps to reproduce the behavior:

  1. Run the file against a MSSQL DB.

Expected behavior
Two rows containing a and b.

Desktop (please complete the following information):

  • SQLTools Version [e.g. v0.17.x] v0.28.3
  • VS Code Version: [e.g 1.x.y] 1.94.1
  • OS: [e.g. Windows, Linux, Mac] MacOS Sequoia 15.1
  • Driver:
    • PostgreSQL/Redshift
    • MySQL/MariaDB
    • MSSQL/Azure
    • SQLite
    • Other? Which...
  • Database version: [e.g. MySQL v5.6, PostgreSQL vX...]
  • Microsoft SQL Server 2014 (SP3-GDR) (KB5029184) - 12.0.6179.1 (X64)
    Jul 27 2023 21:44:30
    Copyright (c) Microsoft Corporation
    Standard Edition (64-bit) on Windows NT 6.3 (Build 9600: ) (Hypervisor)

Test File.SQL
`
SET ANSI_NULLS ON
GO
;

SET QUOTED_IDENTIFIER ON
GO
;

IF EXISTS (
SELECT *
FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[Test_WS_Rpt_SubOptCodesSp1]')
AND type IN (N'P', N'PC')
)
DROP PROCEDURE [dbo].[Test_WS_Rpt_SubOptCodesSp1]
GO

;CREATE PROCEDURE [dbo].[Test_WS_Rpt_SubOptCodesSp1] (@item ItemType)
AS
BEGIN

select * from (
values ('a'),('b')
) as X(a)

END
GO

EXEC Test_WS_Rpt_SubOptCodesSp1 @item = 'test'`

@neospud1 neospud1 added the triage label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant