sql server - VS Database Project Primary Key Name -


i have database project in visual studio 2015. name primary key seems ignore attempts. naming default constraints though work.

create table [dbo].[stock] (     [id] int constraint [pk_stock_id] not null primary key,      [stockcode] nvarchar(6) not null,      [createddate] datetime2 constraint [df_stock_createddate] default sysutcdatetime() not null ) go 

if click on primary key has name property readonly. got create script rather publish sql server , strips out word constraint , name on primary key.

this work you:

create table [dbo].[stock] ( [id] int not null,  [stockcode] nvarchar(6) not null,  [createddate] datetime2 not null ) go  alter table dbo.stock  add constraint df_stock_createddate default getdate() createddate go  alter table dbo.stock add constraint pk_stock_id primary key clustered  ( id ) go 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -