I'm trying to use a dynamically constructed query to get data from an ms sql server(2008) in perl.
The sql-string looks like this:
$sql = (q/SELECT COUNT(DISTINCT COLUMNa) FROM TABLEa WHERE COLUMNb = '$var'/);
When I try to execute this I get the 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 the varchar value '$var' to data type tinyint.
at ./scriptname.pl line 32.
TABLEa
? How are you executing the command? What is in$var
?