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

关于infonmix锁表的有关问题

2012-03-07 
关于infonmix锁表的问题在我存储过程CREATE PROCEDURE [gettransdata]ASdeclare @a varchar(1000),@b varc

关于infonmix锁表的问题

在我存储过程

CREATE PROCEDURE [gettransdata] 
AS

declare @a varchar(1000),@b varchar(1000)

declare @sql as varchar(1000)

set @a= (select max(ttdte) from ith )

set @b= (select max(ttdte) from ithlot )

print @a

print @b

delete from ith where ttdte>=@a

delete from ithlot where ttdte>=@b

set @a='select * from ith where ttdte>=' + @a

set @b='select * from ithlot where ttdte>=' + @b


set @sql = 'insert into ith SELECT C.* FROM OPENROWSET (''MSDASQL'',''dfs_prod'';''pencil'';''dfs123'','''+ @a +''') AS C'

print @sql

exec (@sql)

set @sql = 'insert into ithlot SELECT C.* FROM OPENROWSET (''MSDASQL'',''dfs_prod'';''pencil'';''dfs123'','''+ @b +''' ) AS C'

print @sql

exec (@sql)
GO

在存储过程中那里加入
set isolation to dirty read;

set lock mode to wait 60;

[解决办法]
这么多插入删除,你都不用trans处理的?
参考:
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ
GO
BEGIN TRANSACTION
delete FROM tc
SELECT * FROM tb
...
COMMIT TRANSACTION

热点排行