sunmingtao / sample-code

3 stars 4 forks source link

Unable to create MS SQL server stored procedure: Incorrect syntax near 'GO'. #276

Closed sunmingtao closed 3 years ago

sunmingtao commented 3 years ago

Msg 102, Level 15, State 1, Procedure SelectAllCustomers, Line 4 [Batch Start Line 51] Incorrect syntax near 'GO'.

CREATE PROCEDURE SelectAllCustomers @City nvarchar(30)
AS
SELECT * FROM TestStudent WHERE studentName = @City
GO;
sunmingtao commented 3 years ago

Removing the semicolon after GO fixes the issue

CREATE PROCEDURE SelectAllCustomers @City nvarchar(30)
AS
SELECT * FROM TestStudent WHERE studentName = @City
GO