From 9e2f8331fe8be9e076403406071b096d116a99fd Mon Sep 17 00:00:00 2001 From: tc-hib <55949036+tc-hib@users.noreply.github.com> Date: Thu, 15 Jul 2021 19:56:08 +0200 Subject: [PATCH] Execute stored procedures through RPC even when there isn't any parameter (#676) --- mssql.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mssql.go b/mssql.go index 6ba4690f..28e19f1f 100644 --- a/mssql.go +++ b/mssql.go @@ -470,7 +470,8 @@ func (s *Stmt) sendQuery(args []namedValue) (err error) { reset := conn.resetSession conn.resetSession = false - if len(args) == 0 { + isProc := isProc(s.query) + if len(args) == 0 && !isProc { if err = sendSqlBatch72(conn.sess.buf, s.query, headers, reset); err != nil { if conn.sess.logFlags&logErrors != 0 { conn.sess.log.Printf("Failed to send SqlBatch with %v", err) @@ -481,7 +482,7 @@ func (s *Stmt) sendQuery(args []namedValue) (err error) { } else { proc := sp_ExecuteSql var params []param - if isProc(s.query) { + if isProc { proc.name = s.query params, _, err = s.makeRPCParams(args, true) if err != nil {