简体   繁体   中英

length restriction for the sql variable on sqlsrv_query?

Is there any known length restriction for the sql variable on sqlsrv_query? I have an application that sends a block of commands do SQL SERVER (insert into..., insert into..., etc). It works fine on Linux (mssql) but on Windows (sqlsrv) the last instructions are ignored. The sql command where the last instructions are lost has 4900 lines.

$qry_str = "";
for () {
    $qry = "INSERT INTO tbl
                (field1,
                 field2,
                 etc)
            VALUES
                ('$val1',
                 '$val2',
                 etc)";
    //echo "<pre>$qry</pre>";
    $qry_str .= "$qry;\n";
}

On sqlsrv_query a sql string larger then 65536 is truncated to 65536 characters. Try to use mssql_query or write your query to file and execute it from sqlcmd tool. This may help you Does Microsoft sqlsrv driver for PHP has limitation on query string length?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM