SAP 9.2: _TmSp_AliasUpdate_OUSR存储过程 是什么功能呢?

create PROC _TmSp_AliasUpdate_OUSR
WITH ENCRYPTION
AS
----------------------------------------------------------------
INSERT INTO [OUSR]([INTERNAL_K], [PASSWORD], [PASSWORD1], [PASSWORD2], [USERID], 
            [USER_CODE], [U_NAME], [GROUPS], [PASSWORD4], 
            [ALLOWENCES], [SUPERUSER], [DISCOUNT], [PASSWORD3], 
            [Info1File], [Info1Field], [Info2File], [Info2Field],
            [Info3File], [Info3Field], [Info4File], [Info4Field],
            [dType], [E_Mail], [PortNum], [OutOfOffic], [SendEMail], 
            [SendSMS])
SELECT [INTERNAL_K], [PASSWORD], [PASSWORD1], [PASSWORD2], [_USER_], 
        [USER_CODE], [_U_NAME], [GROUPS], [PASSWORD4], 
        [ALLOWENCES], [SUPERUSER], [DISCOUNT], [PASSWORD3], 
        [Info1File], [Info1Field], [Info2File], [Info2Field],
        [Info3File], [Info3Field], [Info4File], [Info4Field],
        [dType], [E_Mail], [PortNum], [OutOfOffic], [SendEMail], 
        [SendSMS]
FROM TEMP_OUSR
 
 
IF  exists (select 1 from syscolumns inner Join 
           sysobjects on sysobjects.id = syscolumns.id
           where sysobjects.name = 'TEMP_OUSR' And 
           syscolumns.name = 'DfltsGroup')
BEGIN
  exec ('UPDATE OUSR
  SET DfltsGroup = TEMP_OUSR.DfltsGroup
  FROM TEMP_OUSR WHERE OUSR.INTERNAL_K = TEMP_OUSR.INTERNAL_K') 
END
 
IF  exists (select 1 from syscolumns inner Join 
           sysobjects on sysobjects.id = syscolumns.id
           where sysobjects.name = 'TEMP_OUSR' And 
           syscolumns.name = 'CashLimit')
BEGIN
  exec ('UPDATE OUSR
  SET CashLimit = TEMP_OUSR.CashLimit
  FROM TEMP_OUSR WHERE OUSR.INTERNAL_K = TEMP_OUSR.INTERNAL_K') 
END
 
IF  exists (select 1 from syscolumns inner Join 
           sysobjects on sysobjects.id = syscolumns.id
           where sysobjects.name = 'TEMP_OUSR' And 
           syscolumns.name = 'MaxCashSum')
BEGIN
  exec ('UPDATE OUSR
  SET MaxCashSum = TEMP_OUSR.MaxCashSum
  FROM TEMP_OUSR WHERE OUSR.INTERNAL_K = TEMP_OUSR.INTERNAL_K') 
END
 
IF  exists (select 1 from syscolumns inner Join 
           sysobjects on sysobjects.id = syscolumns.id
           where sysobjects.name = 'TEMP_OUSR' And 
           syscolumns.name = 'Fax')
BEGIN
  exec ('UPDATE OUSR
  SET Fax = TEMP_OUSR.Fax
  FROM TEMP_OUSR WHERE OUSR.INTERNAL_K = TEMP_OUSR.INTERNAL_K') 
END
 
IF  exists (select 1 from syscolumns inner Join 
           sysobjects on sysobjects.id = syscolumns.id
           where sysobjects.name = 'TEMP_OUSR' And 
           syscolumns.name = 'SendFax')
BEGIN
  exec ('UPDATE OUSR
  SET SendFax = TEMP_OUSR.SendFax
  FROM TEMP_OUSR WHERE OUSR.INTERNAL_K = TEMP_OUSR.INTERNAL_K') 
END
 
IF  exists (select 1 from syscolumns inner Join 
           sysobjects on sysobjects.id = syscolumns.id
           where sysobjects.name = 'TEMP_OUSR' And 
           syscolumns.name = 'ALLOWENCS1')
BEGIN
  exec ('UPDATE OUSR
  SET ALLOWENCS1 = TEMP_OUSR.ALLOWENCS1
  FROM TEMP_OUSR WHERE OUSR.INTERNAL_K = TEMP_OUSR.INTERNAL_K') 
END
 
IF  exists (select 1 from syscolumns inner Join 
           sysobjects on sysobjects.id = syscolumns.id
           where sysobjects.name = 'TEMP_OUSR' And 
           syscolumns.name = 'Department')
BEGIN
  exec ('UPDATE OUSR
  SET Department = TEMP_OUSR.Department
  FROM TEMP_OUSR WHERE OUSR.INTERNAL_K = TEMP_OUSR.INTERNAL_K AND
                       NOT TEMP_OUSR.Department is NULL') 
END
 
IF  exists (select 1 from syscolumns inner Join 
           sysobjects on sysobjects.id = syscolumns.id
           where sysobjects.name = 'TEMP_OUSR' And 
           syscolumns.name = 'Branch')
BEGIN
  exec ('UPDATE OUSR
  SET Branch = TEMP_OUSR.Branch
  FROM TEMP_OUSR WHERE OUSR.INTERNAL_K = TEMP_OUSR.INTERNAL_K AND
                       NOT TEMP_OUSR.Branch is NULL')  
END
 
DROP TABLE TEMP_OUSR

  

posted @ 2023-08-24 20:09  samrv  阅读(16)  评论(0编辑  收藏  举报