PHP 和 SQL 2008 - 截断表不起作用



为什么这个表不会被截断? 不返回任何错误。 如果我在 SQL Server Management Studio 中运行截断 SQL,它会正常截断。

$truncate = "USE energyDB truncate table temp_energydata";
// Initiate connection to energyDB MS SQL server
    $connection = sqlsrv_connect($serverName, $connectionInfo);
    if( $connection ) {
     echo "Connection established.";
}else{
     echo "Connection could not be established.<br />";
     die( print_r( sqlsrv_errors(), true));
}
    // Start the query on the Database server
    $statement = sqlsrv_query($connection,$truncate);
    if( $statement ) {
     echo "Truncate Query completed.";
}else{
     echo "Query not completed.<br />";
     die( print_r( sqlsrv_errors(), true));

@user1745767

$truncate = "使用能量数据库截断表 [temp_energydata]";

尝试这样,大都会也花了几个小时。

最新更新