zoukankan      html  css  js  c++  java
  • Remove function

    if exists (select * from tempdb.dbo.sysobjects where id = object_id(N'tempdb..#table') and type='U')
      DROP TABLE #table 
              
    CREATE TABLE #table
        (
          [RECNUM] [decimal](28, 0) IDENTITY(1, 1)     NOT NULL ,
          ModuleCode NVARCHAR(30) COLLATE SQL_Latin1_General_CP1_CI_AS       NULL ,
          FunctionCode NVARCHAR(30) COLLATE SQL_Latin1_General_CP1_CI_AS       NULL ,
          FuncDescription NVARCHAR(30) COLLATE SQL_Latin1_General_CP1_CI_AS  NULL,
          Process_Code NVARCHAR(30) COLLATE SQL_Latin1_General_CP1_CI_AS      NULL,
          Menu_Type NVARCHAR(30) COLLATE SQL_Latin1_General_CP1_CI_AS   NULL                                  
        )

    INSERT  INTO #table(ModuleCode, FunctionCode , FuncDescription,Process_Code,Menu_Type)
            SELECT  'PRSF', 'PRSFRT' ,  'Matrial Reservation Transfer','M6_ENT','ENTRY'
            UNION ALL
            SELECT 'PRSF', 'PRSFRC' ,'Routing Process Completion','M6_ENT','ENTRY'
            UNION ALL
            SELECT 'PRPE', 'PRPEMJ' ,'Mass ECN','M4_ENT','ENTRY'
            UNION ALL
            SELECT 'PRPM', 'PRPMMJ' ,'Mass ECN','M4_ENT','ENTRY'
            UNION ALL
            SELECT 'SAMF', 'SAMFRP' ,'Routing Process','MAST01','MAST'
            UNION ALL
            SELECT 'SAMF', 'SAMFRP' ,'Bom Routing Process Settings','MAST01','MAST'
            UNION ALL
            SELECT 'SAMF', 'SAMFCL' ,'Collection Master','MAST01','MAST'
            UNION ALL
            SELECT 'SAMF', 'SAMFSY' ,'Style Master','MAST01','MAST'
            UNION ALL
            SELECT  'SAMF','SAMFCO' ,'Color Master','MAST01','MAST'
            UNION ALL
            SELECT 'PRPM', 'PRMJU' , 'Job BOM Update','M4_ENT','ENTRY'
           
           
     Declare @RECNUM int
    Declare @ModuleCode Nvarchar(30)
    Declare @FunctionCode Nvarchar(30)
    Declare @Process_Code Nvarchar(30)
    Declare @Menu_Type Nvarchar(30)


    Declare Cur Cursor For Select [RECNUM] From #table  
    Open Cur
    Fetch next From Cur Into @RECNUM
    While @@fetch_status=0    
    BEGIN
         SELECT @ModuleCode=ModuleCode,@FunctionCode=FunctionCode,@Process_Code=Process_Code,@Menu_Type=Menu_Type
             FROM #table WHERE RECNUM=@RECNUM
        
         --[USER_GROUP], [PROCESS_CODE], [MENU_TYPE], [MENU_CODE]
         DELETE ADMNUD WHERE USER_GROUP='SYSADM' AND PROCESS_CODE=@Process_Code AND MENU_TYPE=@Menu_Type AND FUNCTION_CODE=@FunctionCode
       
         --([USER_GROUP], [MODULE_CODE], [FUNCTION_NO])
         DELETE  ADAUTD WHERE USER_GROUP='SYSADM' AND MODULE_CODE=@ModuleCode AND FUNCTION_CODE=@FunctionCode
        
         --[MODULE_CODE], [FUNCTION_NO]
         DELETE ADFUNC WHERE MODULE_CODE=@ModuleCode AND FUNCTION_CODE=@FunctionCode 
       
        
         Fetch next From Cur Into @RECNUM
    End  
    Close Cur  
    Deallocate Cur

  • 相关阅读:
    JVM调优总结
    如何使用 Java 泛型来避免 ClassCastException
    JAVA中的断言是什么?有什么陷阱?
    JVM Thread Dump 文件分析
    学习单例模式引发的思考
    JVM生成的3种文件,你都见过吗?
    一文搞懂什么是事务
    bug处理流程
    BUG等级说明
    测试执行标准
  • 原文地址:https://www.cnblogs.com/JamesLi2015/p/2995880.html
Copyright © 2011-2022 走看看