I want to execute this (simplified) query using node-mssql
that executes in SQL Server 2017 fine:
USE [Journal]
[GO]
CREATE PROCEDURE [dbo].[EventDelete]
@NotificationID INT
AS
DELETE Notification
WHERE NotificationID = @NotificationID
[GO]
node-mssql
declares syntax error using [GO]
and requires semicolon, therefore I try this:
USE [Journal];
CREATE PROCEDURE [dbo].[EventDelete]
@NotificationID INT
AS
DELETE Notification
WHERE NotificationID = @NotificationID;
Now we get error:
CREATE/ALTER PROCEDURE' must be the first statement in a query batch.
So let's try this:
CREATE PROCEDURE [Journal].[dbo].[EventDelete]
@NotificationID INT
AS
DELETE Notification
WHERE NotificationID = @NotificationID;
Now we get
RequestError: 'CREATE/ALTER PROCEDURE' does not allow specifying the database name as a prefix to the object name.
Naturally without any DB declaration it attempts to attach to the master error:
CREATE PROCEDURE permission denied in database 'master'.