简体   繁体   English

插入身份表列值

[英]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.

相关问题 无法为表中的标识列插入显式值 - Cannot insert explicit value for identity column in table 将值0插入标识列 - Insert a value of 0 into identity column 从另一个表中将标识列值插入表中? - Insert identity column value into table from another table? SqlException:当 IDENTITY_INSERT 设置为 OFF 时,无法为表 [表名] 中的标识列插入显式值 - SqlException: Cannot insert explicit value for identity column in table [Table name] when IDENTITY_INSERT is set to OFF 当 IDENTITY_INSERT 设置为 OFF 时,无法在表“table”中为标识列插入显式值 - Cannot insert explicit value for identity column in table 'table' when IDENTITY_INSERT is set to OFF 仅当使用列列表且IDENTITY_INSERT为ON时,才能为表&#39;Table&#39;中的标识列指定一个显式值。 - An explicit value for the identity column in table 'Table' can only be specified when a column list is used and IDENTITY_INSERT is ON 创建播放器时,无法为表中的身份列插入显式值 - Cannot insert explicit value for identity column in table when player is created 实体框架错误:无法为表中的标识列插入显式值 - Entity Framework error: Cannot insert explicit value for identity column in table 当IDENTITY_INSERT设置为OFF时,无法在表'ClientDetails'中为identity列插入显式值 - Cannot insert explicit value for identity column in table 'ClientDetails' when IDENTITY_INSERT is set to OFF “当IDENTITY_INSERT设置为OFF”时,无法使用复合键为表中的标识列插入显式值 - “Cannot insert explicit value for identity column in table when IDENTITY_INSERT is set to OFF” with composite key
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM