[英]insert identity table column value
i have table propertybag, it's have only one identity coloumn 我有桌子的财产袋,只有一个身份
fo eg 如
propertybagid identity(1,1)
i want to insert this value to this column one by one by query how? 我想通过查询如何将此值一一插入到此列中?
plz reply soon 请尽快回复
Insert into propertybagid default values
INSERT T DEFAULT VALUES
Or to insert multiple rows (up to 2048 at a time using the spt_values table) 或插入多行(使用spt_values表一次最多可达2048)
SET IDENTITY_INSERT t ON
INSERT INTO t (id)
SELECT Number + COALESCE(IDENT_CURRENT('t'),0) + 1
FROM master.dbo.spt_values
where type='p' and number < 2048
SET IDENTITY_INSERT t OFF
INSERT INTO <tablename> DEFAULT VALUES;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.