diff --git a/source/shared/core_stmt.cpp b/source/shared/core_stmt.cpp index 982a64b4..285764b1 100644 --- a/source/shared/core_stmt.cpp +++ b/source/shared/core_stmt.cpp @@ -384,7 +384,14 @@ void core_sqlsrv_bind_param( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT param_ if( zval_was_null || zval_was_bool ) { convert_to_long( param_z ); } - match = Z_TYPE_P( param_z ) == IS_LONG; + if( zval_was_long ){ + convert_to_string( param_z ); + encoding = SQLSRV_ENCODING_SYSTEM; + match = Z_TYPE_P( param_z ) == IS_STRING; + } + else { + match = Z_TYPE_P(param_z) == IS_LONG; + } break; case SQLSRV_PHPTYPE_FLOAT: if( zval_was_null ) {