perlDBIのbind_paramに関する問題があります。次のSQLが機能します。
my $sth = $dbh->prepare("SELECT id FROM table WHERE id = 'string'");
$sth->execute();
以下はそうではありませんが:
my $sth = $dbh->prepare("SELECT id FROM table WHERE id = ?");
$sth->execute('string');
最後のクエリで発生するエラーはです[ODBC SQL Server Driver][SQL Server]The data types nvarchar(max) and ntext are incompatible in the equal to operator. (SQL-42000)
。
bind_param
によって呼び出されるexecute
、が'string'をntextにキャストするようです。どうすればそれを回避できますか?