如果用触发器
delete kemployce where kcode in (select kcode from inserted)
insert kemployce select * from inserted
报错:仅当使用列的列表,并且identity_insert 为 on 时,才能在表..指定显示值请各位给出 其它的 好的办法呀!
delete kemployce where kcode in (select kcode from inserted)
insert kemployce select * from inserted
报错:仅当使用列的列表,并且identity_insert 为 on 时,才能在表..指定显示值请各位给出 其它的 好的办法呀!
解决方案 »
- 成功插入后显示"1行被上次查询影响"
- 请问这段代码是什么含义,,急
- txt文件导入SQL数据库乱码问题
- 求成長率SQL語句,高人指點,在綫等,急
- 求一SQL语句,请高手帮忙.
- join 查询怎么用?
- 怎样知道一个JOB已经成功执行完毕?
- sql server 2000 安全管理与用户的问题
- sql语句分组问题?
- Delphi中使用ADO组件在报表中打印表中字段的所有内容
- 各位高手,请问如何同时更改数据库名以及更改数据库的物理文件名?
- 为什么说java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]用户 'sa' 登录失败。?
insert kemployce (kcode,kname) select kcode,kname from inserted
delete kemployce where kcode in (select kcode from inserted)
insert kemployce select * from inserted
是不行的,如果要使用触发器可以使用
INSTEAD OF 触发器
instead of insert
asdelete kemployce where kcode in (select kcode from inserted)
insert kemployce select * from inserted但你的id顺序将会打乱,插入的新数据只会再原来基础上递增
比如插入kcode=000001 kname =小猫的妈妈 id将为4
愚见,仅供参考!
使用instead of 触发器!
这样的话就可以不执行引起instead of trigger的语句,而执行instead of trigger的语句!
happydreamer 的方法可行!但现在有个问题,在这之前我已经牺牲了一个image 字段。能起死回生不?(之前报错:表在有image 字段 不能用此方法触发)