简体   繁体   中英

Visual Studio 2012 does not create new SQL table

I want to create a simple SQL table in Visual Studio 2012 that th id field is Auto increment primary key, so I do like this :

在此处输入图片说明

But when I want to Update and create table it errors :

** Highlights
     Tables that will be rebuilt
       None
     Clustered indexes that will be dropped
       None
     Clustered indexes that will be created
       None
     Possible data issues
       None

** User actions
     Create
       [dbo].[sotbl] (Table)
       Default Constraint on [dbo].[sotbl].[Id] (Default Constraint)

** Supporting actions

在此处输入图片说明

Creating [dbo].[sotbl]... Creating Default Constraint on [dbo].[sotbl].... (86,1): SQL72014: .Net SqlClient Data Provider: Msg 1754, Level 16, State 0, Line 1 Defaults cannot be created on columns with an IDENTITY attribute. Table 'sotbl', column 'Id'. (86,1): SQL72014: .Net SqlClient Data Provider: Msg 1750, Level 16, State 0, Line 1 Could not create constraint. See previous errors. An error occurred while the batch was being executed.

Remove the default value from the Id column definition.

If it is an identity column the initial entry will be set to the 'Identity Seed' value and subsequent records will be updated based on the 'Identity Increment' value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM