Sql server 即使在SSMA v 6.0中关闭了ROWID列的生成,也会触发ROWID列的生成

Sql server 即使在SSMA v 6.0中关闭了ROWID列的生成,也会触发ROWID列的生成,sql-server,oracle,database-migration,sql-server-2014,sql-server-migration-assi,Sql Server,Oracle,Database Migration,Sql Server 2014,Sql Server Migration Assi,我使用SSMA v6.0将Oracle数据库迁移到SQL Server 2014 我关闭了ROWID列的生成,正如预期的那样,它在转换后没有在我的任何表中生成任何额外的ROWID列,但令人惊讶的是,它确实生成了与各自表关联的所有触发器,其中ROWID列插入了触发器,如下所示: USE [DBName] GO /****** Object: Trigger [dbo].[InsteadOfInsertOn$ROLEPERMISSIONS] Script Date: 3/11/2015 10

我使用SSMA v6.0将Oracle数据库迁移到SQL Server 2014

我关闭了ROWID列的生成,正如预期的那样,它在转换后没有在我的任何表中生成任何额外的ROWID列,但令人惊讶的是,它确实生成了与各自表关联的所有触发器,其中ROWID列插入了触发器,如下所示:

USE [DBName]
GO
/****** Object:  Trigger [dbo].[InsteadOfInsertOn$ROLEPERMISSIONS]    Script Date: 3/11/2015 10:58:46 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[InsteadOfInsertOn$ROLEPERMISSIONS]
   ON [dbo].[ROLEPERMISSIONS]
    INSTEAD OF INSERT
      AS 
         /*Generated by SQL Server Migration Assistant for Oracle version 6.0.0.*/
         BEGIN

        SET  NOCOUNT  ON

        DECLARE
           @triggerType char(1)

        SELECT @triggerType = 'I'

        /* column variables declaration*/
        DECLARE
           @new$0 uniqueidentifier, 
           @new$ROLEID decimal, 
           @new$MODULES_ACTIONSID decimal, 
           @new$ROLEPERMISSIONID decimal

        /* 
        *   SSMA error messages:
        *   O2SS0239: ROWID column is not accessible because the 'Generate ROWID' project setting is disabled.

        DECLARE
            ForEachInsertedRowTriggerCursor CURSOR LOCAL FORWARD_ONLY READ_ONLY FOR 
              SELECT ROWID, ROLEID, MODULES_ACTIONSID, ROLEPERMISSIONID
              FROM inserted            */


        /* 
        *   SSMA error messages:
        *   O2SS0174: The declaration of the identifier 'ForEachInsertedRowTriggerCursor' was converted with error(s).

        OPEN ForEachInsertedRowTriggerCursor            */

        /* 
        *   SSMA error messages:
        *   O2SS0174: The declaration of the identifier 'ForEachInsertedRowTriggerCursor' was converted with error(s).

        FETCH ForEachInsertedRowTriggerCursor
            INTO @new$0, @new$ROLEID, @new$MODULES_ACTIONSID, @new$ROLEPERMISSIONID            */

        WHILE @@fetch_status = 0
        BEGIN
              /* row-level triggers implementation: begin*/
              BEGIN
                 BEGIN
                    IF @triggerType = 'I'
                       SELECT @new$ROLEPERMISSIONID = NEXT VALUE FOR dbo.SEQ_ROLEPERMISSIONS
                 END
              END
              /* row-level triggers implementation: end*/

              /* 
              *   SSMA error messages:
              *   O2SS0239: ROWID column is not accessible because the 'Generate ROWID' project setting is disabled.

              /-* DML-operation emulation*-/
              INSERT dbo.ROLEPERMISSIONS(ROWID, ROLEID, MODULES_ACTIONSID, ROLEPERMISSIONID)
                 VALUES (@new$0, @new$ROLEID, @new$MODULES_ACTIONSID, @new$ROLEPERMISSIONID)                  */



              /* 
              *   SSMA error messages:
              *   O2SS0174: The declaration of the identifier 'ForEachInsertedRowTriggerCursor' was converted with error(s).

              FETCH ForEachInsertedRowTriggerCursor
                  INTO @new$0, @new$ROLEID, @new$MODULES_ACTIONSID, @new$ROLEPERMISSIONID                  */

           END

        /* 
        *   SSMA error messages:
        *   O2SS0174: The declaration of the identifier 'ForEachInsertedRowTriggerCursor' was converted with error(s).

        CLOSE ForEachInsertedRowTriggerCursor            */

        /* 
        *   SSMA error messages:
        *   O2SS0174: The declaration of the identifier 'ForEachInsertedRowTriggerCursor' was converted with error(s).

        DEALLOCATE ForEachInsertedRowTriggerCursor            */
     END
简言之,问题在于

  • 关闭ROWID列生成后,它没有在任何表中创建任何确切需要的ROWID列

  • 但它确实创建了所有触发器,就好像ROWID列在表中一样

  • 是的,它生成了一个触发器,对所有需要ROWID的查询进行注释。。。(从示例存储过程中可以看到)


  • 是否有其他方法/选项也必须关闭从触发器生成ROWID

    您在Oracle中的触发器是每行的
    。SQL Server不直接支持这种类型的触发器。因此,SSMA使用
    而不是
    触发器并在
    插入的
    上循环应用模板替换

    能否至少为具有触发器的表启用ROWID(转换设置中的“为具有触发器的表添加ROWID列”选项)?SSMA不支持在没有它的情况下自动转换此类触发器,否则您可能必须手动修改转换后的触发器。(这就是为什么它仍然尝试尽可能多地转换,但保留了对缺少的ROWID列的访问,因此您可以手动完成转换)