关于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