文章已搬家,請點擊前往👈

 

 

 

 

How to truncate a table with foreign Key in SQL Server.

當想要清空資料表時,我們可以用TRUNCATE語句來達到,但是當該資料表有使用外部索引鍵時,會出現如下錯誤:

無法截斷資料表'Table',因為該資料表正由FOREIGN KEY 條件約束參考
Cannot truncate table 'Table' because it is being referenced by a FOREIGN KEY constraint
arrow
arrow

    emn178 發表在 痞客邦 留言(1) 人氣()