Skip to content

Execute system stored procedure #327

@liamk-fleetops

Description

@liamk-fleetops

I'm writing an Electron App for windows which connects to a local SQL Server and configures some CDC settings. I am having difficulties running system stored procedures. It recognizes the SP names as it doesn't error on getting them (as it does when I make a typo) but the proc.meta.params only shows an @returns param for both of the below SPs.

sys.sp_cdc_change_job

sql.open(connectionString, (err, conn) => {
    conn.procedureMgr().get('sys.sp_cdc_change_job', (proc) => {
      proc.call({
        "job_type": "Cleanup",
        "retention": 4320
      }, (err, res, output) => {
        console.log(err, res, output);
      });
    });
  });

error: proc error Error: sys.sp_cdc_change_job: illegal params on param object = job_type,retention


sys.sp_cdc_enable_db

sql.open(connectionString, (err, conn) => {
    conn.procedureMgr().get('sys.sp_cdc_enable_db', (proc) => {
      proc.call([], (err, res, output)=> {
        console.log(err, res, output);
      });
    });
  });

error: proc error [Error: [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure sp_cdc_enable_db has no parameters and arguments were supplied.]

Connection string:

Driver={SQL Server};Server={*.*.*.*,1433};Database={database_name};Trusted_Connection={yes};
package version
NodeJS 21.7.1
Electron 29.3.0
msnodesqlv8 4.1.2
node-gyp 10.1.0
visual studio c++ 2022
OS Windows Server 2016 Datacenter
database SQL Server 2017

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions