首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

:sql server中事务为什么没作用

2012-02-03 
请教高手:sql server中事务为什么没作用?请教高手:sqlserver中事务为什么没作用?代码如下:begintransactio

请教高手:sql server中事务为什么没作用?
请教高手:sql   server中事务为什么没作用?
代码如下:
begin   transaction  
update   table1
set   name1= 'aaa '   where   id=1     --这个id不存在
if   @@error <> 0
      ROLLBACK   TRANSACTION
update   table2   set   name2= 'bbb '   where   id==2
if   @@error <> 0
      ROLLBACK   TRANSACTION      
commit   transaction

table1中id=1是不存在的,但table2始终能修改,根据事务原理,table2是不能修改的,为什么我这里能修改?百思不得其解!!是设置不对?

[解决办法]
写错了,把and改成or

热点排行
Bad Request.