从 perl 执行存储过程时出错。我可以毫无问题地从 perl 连接到 MS SQL 服务器。但是当我使用以下绑定参数执行该过程时,我收到了错误
[Microsoft][ODBC SQL Server Driver][SQL Server]'@id' 附近的语法不正确。(SQL-42000)
这个'id'是第一个参数。当我查看程序时,它很好。有人对此错误有任何想法吗?
代码
#GetStatusDescription(?, ?, ?) - id - LONG, status - VARCHAR, description - VARCHAR
my $sth = $dbh -> prepare('exec GetStatusDescription(?, ?, ?)');
my $str1, my $str2;
my $intid = 11122;
use DBI qw(:sql_types);
$sth->bind_param(1, $intid, DBI::SQL_INTEGER);
$sth->bind_param_inout(2, \$str1, DBI::SQL_VARCHAR);
$sth->bind_param_inout(3, \$str2, DBI::SQL_VARCHAR);
$sth->execute() or die $dbh -> errstr;