0
Under review

NONCLUSTERED PRIMARY KEY

Dixant Rai 6 year бұрын жаңартылды 6 year бұрын 5

Is it possible to create NONCLUSTERED PrimaryKey while still using the PK flag to identify them? I'm trying to achieve this in sql server.

Under review

Hi,


Yes, this is possible - please see the screenshot with settings.


The generated SQL is:

-- Created by Vertabelo (http://vertabelo.com)
-- Last modification date: 2019-03-19 09:08:17.929
-- tables
-- Table: sample_table
CREATE TABLE sample_table (
   sample_column int  NOT NULL,
   CONSTRAINT sample_table_pk PRIMARY KEY  (sample_column)
);
CREATE NONCLUSTERED INDEX sample_index on sample_table (sample_column DESC)
;
-- End of file.


Best regards,

Mariusz Zakrzewski

Hello Mariusz, thanks for getting back to me. That is not what I meant. What I was trying to do would result in this DDL

CREATE TABLE sample_table (
   sample_column int  NOT NULL,
   CONSTRAINT sample_table_pk PRIMARY KEY NONCLUSTERED (sample_column)
);

Sorry for delayed response.

It is currently not supported. I can suggest you dropping an index and creating it manually, e.g. in 'Additional SQL scripts -> After creating table' section.

Sorry for the inconvenience,

Mariusz Zakrzewski