sqlserver中SET identity_insert on的问题!

/* Data for table DM_abhyasaDay */
SET identity_insert [dsc070763].[DM_abhyasaDay] on

SET identity_insert [dsc070763].[DM_abhyasaDay] off
GO
/* Data for table DM_abhyasaLong */
SET identity_insert [dsc070763].[DM_abhyasaLong] on

SET identity_insert [dsc070763].[DM_abhyasaLong] off
GO
/* Data for table DM_abhyasaWeek */
SET identity_insert [dsc070763].[DM_abhyasaWeek] on

SET identity_insert [dsc070763].[DM_abhyasaWeek] off
GO
/* Data for table DM_abhyasaYear */
SET identity_insert [dsc070763].[DM_abhyasaYear] on

SET identity_insert [dsc070763].[DM_abhyasaYear] off
GO
/* Data for table DM_book */
SET identity_insert [dsc070763].[DM_book] on

SET identity_insert [dsc070763].[DM_book] off
GO
这段代码什么意思?

一般字段如果是identity的,比如定义的时候nameid identity(1,1)就是说从1开始增长,每次加1,那么插入一条记录nameid字段是不需要赋值(一般也不允许)。那么有时候想自己插入nameid字段值,就用set identity_insert on就可以手动插入了。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2010-05-15
SET identity_insert on使表中的identity字段可以插入自定的数据,否则只能系统自增

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网