当前位置: 技术问答>java相关
jsp与sql中的事务问题。。。
来源: 互联网 发布时间:2015-10-03
本文导语: 在优化应用程序时,要对同时插入数据库的sql语句使用事务,怎么用最好? 比如: declare @transaction_name varchar(32) select @transaction_name='my_transaction_delete' begin transaction @transaction_name go use database1 go delete from department...
在优化应用程序时,要对同时插入数据库的sql语句使用事务,怎么用最好?
比如:
declare @transaction_name varchar(32)
select @transaction_name='my_transaction_delete'
begin transaction @transaction_name
go
use database1
go
delete from department where dept_id='1012'
go
delete from employee where dept_id='1012'
go commit transaction my_transaction_delete
go
该怎么用?在jsp中经常是一句String sqlstr="";
现在有这么多句。。。
比如:
declare @transaction_name varchar(32)
select @transaction_name='my_transaction_delete'
begin transaction @transaction_name
go
use database1
go
delete from department where dept_id='1012'
go
delete from employee where dept_id='1012'
go commit transaction my_transaction_delete
go
该怎么用?在jsp中经常是一句String sqlstr="";
现在有这么多句。。。
|
建议你干脆在数据库中建一个视图,然后再jsp中调用好了,不然实在太多了
呵呵。
i 服了 u 了
:P
呵呵。
i 服了 u 了
:P