sql - Does Microsoft sqlsrv driver for PHP has limitation on query string length? -
i'm using php 5.5.7 , sqlsrv driver microsoft
i attempted insert multiple rows single sql query string size around 1mb sql server inserted 1500 row 220k of query string , give error incorrect syntax seem truncated.
i never met problem mssql driver.
did wrong?
i don't know "limit" had same issue , went 4kb limit before writing query file , using sqlcmd command line tool import file sql server.
there doesn't appear way determine true limit or adjust it.
if(strlen($query) > 4096) { $fname = time() . rand(0,10000) . '.txt'; $fp = fopen($fname, 'w'); fwrite($fp, $query); fclose($fp); $output = []; exec('sqlcmd -u' . mssql_user . ' -p"' . mssql_pass . '" -s' . mssql_host . ' -i' . $fname, $output); $returnval['exec'] = implode(php_eol, $output); $returnval['error'] = ''; unlink($fname); } else { sqlsrv_query(...); }
Comments
Post a Comment