发布:2014/6/20 8:44:20作者:管理员 来源:本站 浏览次数:1275
SQL2005以前的数据库是不允许向自动增量字段中写入内容的,ACCESS也不行,但在SQL2005开始,就可以向自动增量字段写入内容了,需要使用SQL2005提供的identity_insert来实现。
1
|
set identity_insert OLD_USER on
|
2
|
insert OLD_USER(userid,username,userpassword,LastLogintime) select userid,username,userpassword,LastLogintime from USER where LastLogintime< '2010-01-01'
|
3
|
set identity_insert OLD_USER off
|
1
|
set identity_insert OLD_USER on
|
2
|
insert OLD_USER(userid,username,userpassword,LastLogintime) VALUES (7, '新用户' , '新密码' , '2012-04-09 08:30:30' )
|
3
|
set identity_insert OLD_USER off
|
© Copyright 2014 - 2024 柏港建站平台 ejk5.com. 渝ICP备16000791号-4