IDENTITY插入
Posted qi123
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了IDENTITY插入相关的知识,希望对你有一定的参考价值。
CREATE TABLE [dbo].[t_PayWay]( [id] [int] IDENTITY(1,1) NOT NULL, [Code] [varchar](20) NULL, [Name] [varchar](200) NULL, [SortCode] [int] NULL, [Enabled] [int] NULL, [DeletionStateCode] [int] NULL, [Description] [nvarchar](200) NULL, [CreateOn] [datetime] NULL, [CreateUserId] [nvarchar](20) NULL, [CreateBy] [nvarchar](20) NULL, [ModifiedOn] [datetime] NULL, [ModifiedUserId] [nvarchar](20) NULL, [ModifiedBy] [nvarchar](20) NULL, [defaultpay] [int] NULL, [YZSK] [int] NULL, [YZDH] [int] NULL, [YZTT] [int] NULL, [DYSK] [int] NULL, [DYDH] [int] NULL, [DYTT] [int] NULL, [CZ] [int] NULL, [YJ] [int] NULL, [ZJ] [int] NULL, [bIsSystemSet] [int] NULL, [bUnCanChange] [int] NULL, CONSTRAINT [PK_T_PAYWAY] 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]
SET IDENTITY_INSERT [dbo].[t_PayWay] ON INSERT [dbo].[t_PayWay] ([id], [Code], [Name], [SortCode], [Enabled], [DeletionStateCode], [Description], [CreateOn], [CreateUserId], [CreateBy], [ModifiedOn], [ModifiedUserId], [ModifiedBy], [defaultpay], [YZSK], [YZDH], [YZTT], [DYSK], [DYDH], [DYTT], [CZ], [YJ], [ZJ], [bIsSystemSet], [bUnCanChange]) VALUES (1, N‘1‘, N‘现金‘, 10000037, 1, NULL, N‘系统配置,不可编辑删除‘, CAST(N‘2016-11-08 11:51:16.213‘ AS DateTime), N‘10000000‘, N‘超级管理员‘, CAST(N‘2017-09-24 13:30:02.220‘ AS DateTime), N‘10000000‘, N‘超级管理员‘, NULL, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, NULL) SET IDENTITY_INSERT [dbo].[t_PayWay] OFF
以上是关于IDENTITY插入的主要内容,如果未能解决你的问题,请参考以下文章
从 C# 代码中使用 SQL Server CE 选择 @@ IDENTITY
使用 Linq-to-SQL 插入,其中 IDENTITY_INSERT 设置为 OFF