PERL: Cant use variables in Sybase SQL Driver to MS SQL Server -
i'm trying use dynamically constructed query data ms sql server(2008) in perl.
the sql-string looks this:
$sql = (q/select count(distinct columna) tablea columnb = '$var'/);
when try execute following error message:
dbd::sybase::st execute failed: server message number=245 severity=16 state=1 line=1 server=hostname text=conversion failed when converting varchar value '$var' data type tinyint. @ ./scriptname.pl line 32.
q() literal. need qq() if want $var interpolated.
$sql = qq/select count(distinct columna) tablea columnb = '$var'/;
also, agree comment on sql injection. should use bind variable instead.
Comments
Post a Comment