The map all clause of the create compareset has several limitations.
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)
)
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
drop index orders.order_num go alter table orders add constraint order_num_pk primary key (order_num) goYou 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.