USE [Task] GO /****** Object: Table [dbo].[Task] Script Date: 04/16/2018 16:14:56 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Task]( [ID] [bigint] IDENTITY(1,1) NOT NULL, [Name] [nvarchar](255) NULL, [DataSource] [nvarchar](255) NULL, [IsOnlyLabel] [bit] NULL, [Zoom] [int] NULL, CONSTRAINT [PK_Task] PRIMARY KEY CLUSTERED ( [ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO
今天遇到个数据库转换,access要转到sql server ,在转换过程中发现access中的id是自增的 但是在sql server中不是,这是我们要自己手动将id主键设为自增,然后保存这个新的表才能够可以。同时代码中也要做相应的修改,
[ID] [bigint] IDENTITY(1,1) NOT NULL,这一句就是将id设为主键的语句,大家要加上哦