I'm trying to get metadata from the tables on my database (sql server). I execute the query to get that metadata on Sql Management Studio and it works but on php script show that error when i do : $row=sqlsrv_fetch_array($res): "Unexpected SQL type encountered in calc_string_size."
I suspected that the problem was on the build of the query string on the php but it's not because i printed that query and it's correct.
The problem appears when i added a field on the select (column description).
Anyone know that problem?
You probably got
sql_variant
somewhere in your query.
That throws an error -> you have to cast the specific columns as VARCHAR
First of all thank you for answer.
my code:
$res=sqlsrv_query($conn,$sql); /that part is working/ while($row=sqlsrv_fetch_array($res)){ /* it's here that the error occurs (...) }
On the query sql if i remove the field (description) on select that works 100%
Any ideas?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With