0
爲什麼這個表不會被截斷?沒有錯誤返回。如果我在SQL Server Management Studio中運行截斷SQL,它通常會截斷。PHP和SQL 2008 - 截斷表不能正常工作
$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
我對PHP並不熟悉,但是有可能無論您使用的連接庫不是默認的「COMMIT」SQL命令嗎? – Pondlife