gusucode.com > 精典源码Delphi044:指纹考勤管理系统源码程序 > 精典源码Delphi044:指纹考勤管理系统源码程序/精典源码Delphi044:指纹考勤管理系统/顺发指纹考勤管理系统/指纹考勤系统/SP_NoMiMa/wbSp_EnableDisableCheckOrFK.txt
/* This Store Procedure is For enabled OR Disable All Chenk or ForeighKey Relation of Get Fiter Tables when 级连 Delete or Update when @EnableFlag=1 then Eanbled else Disable Create By "wangBin" Create Date "1999-12-17" */ CREATE PROCEDURE wbSp_EnableDisableCheckOrFK @EnableFlag Bit, -- Enable or Disable @TableFiter VarChar(20) -- Deal Tables Filer AS declare @currentTableName VarChar(50) begin -- Get All Table of Want Deal to Curosr Declare DealtableNames CURSOR FOR Select name from sysobjects where name like @TableFiter OPEN DealtableNames Fetch Next From DealTableNames INTO @currentTableName While (@@FETCH_STATUS=0) BEGIN --1. enabled All Chenk or ForeighKey Relation to Tables if @EnableFlag=1 Execute("Alter table "+@currentTableName+" CHECK CONSTRAINT all ") else Execute("Alter table "+@currentTableName+" NOCHECK CONSTRAINT all ") Fetch Next From DealTableNames INTO @currentTableName END -- END while Close DealtableNames Deallocate DealtableNames Return end