我們在刪除乙個表資料時,經常遇到存在約束,刪除不了該資料,可以先禁用約束,然後刪除掉該資料後,在啟用約束,
注意:禁用約束後約束的兩個表資料都要刪掉,不然資料會不對
禁用:select * from (
select 'alter table [' + b.name + '] nocheck constraint ' + a.name +';' as 禁用約束
from sysobjects a ,sysobjects b
where a.xtype ='f' and a.parent_obj = b.id)abs
where 禁用約束 like '%刪除時遇到的約束名%'
啟用:select * from (
select 'alter table [' + b.name + '] check constraint ' + a.name +';' as 啟用約束
from sysobjects a ,sysobjects b
where a.xtype ='f' and a.parent_obj = b.id)abs
where 啟用約束 like '%刪除時遇到的約束名%'
上面兩行sql是查詢出約束的sql,然後把查出來的sql執行一下就可以了【除了」刪除時遇到的約束名「相當於變數,其他照抄】
ref:
臨時禁用Resharper
q 解除安裝了resharper,怎麼vs的智慧型提示也沒有了?配置哪個地方?a tools options text editor c general statement completion 打上鉤就行了。resharper 是乙個visualstudio外掛程式,vs2010利器,能大大提高程...
修改linux核心的啟動logo和禁用啟動游標
linux核心下使用的檔案型別是pnm和ppm格式的,所以在開始介紹修改linux核心啟動logo之前,1,先需要介紹一下怎麼樣設計自己開始logo的ppm,首先選擇一張png格式的 使用如下命令確保你必須安裝以下的工具 pngtopnm,pnmquant,pnmtoplainpnm 如果沒有安裝,...
linux中臨時禁用使用者
linux中臨時禁用使用者 1.在 etc passwd檔案中找到禁用使用者所在行,在該行首新增 etc passwd coderbolg x 500 500 home coderbolg bin bash 2.在 etc shadow 檔案中找到禁用使用者所在行,在第二個字段 密碼加密字段 前新增...