Limitations

The map all clause of the create compareset has several limitations.

  • Your source and target database tables must have at least one primary key column or one identity column defined when using the map all statement in create compareset. For example, map all statement works if you create your table with a primary key or identity column:
    CREATE TABLE orders (
        order_num INTEGER NOT NULL PRIMARY KEY,
        date_ordered DATE,
        name CHAR(80)
      )
    CREATE TABLE orders (
        order_num INTEGER IDENTITY,
        date_ordered DATE,
        name CHAR(80)
     )
  • If your table does not have a primary key or identity column, enforcing a primary key using sp_primarykey stored procedure does not enable map all to work.
    For example, map all cannot map a table defined like this:
    CREATE TABLE orders (
        order_num INTEGER NOT NULL,
        date_ordered DATE,
        name CHAR(80)
      )
      sp_primarykey orders, order_num
      go
      create unique clustered index ordernumidx on orders(order_num)
      go
    The map all clause cannot be used here because a table with a primary key defined using the sp_primarykey system procedure still lacks a primary key integrity constraint. In such a case, you must alter the table to enforce a primary key integrity constraint. For example:
      
    drop index orders.order_num
    go
    alter table orders
    add constraint order_num_pk
    primary key (order_num)
    go
    
    You can verify that a table has a primary-key constraint by using the sp_helpconstraint system procedure. See Adaptive Server Enterprise Transact-SQL Users Guide > Creating Databases and Tables > Defining integrity constraints for tables > Specifying unique and primary key constraints.
  • When using the map all statement in create compareset, the source and target table columns must have identical names.