几个应用程序在同一个表和值上工作 [英] few application work on same table and values
问题描述
我有SP,它从几张表中获取数据。
我的主列是状态:
0 -not updated
1- in进度
>
2完成
>>
和SourceType (当我输入数据时,可以是1到100
>>
>
选择前500名.....
其中status = 0且SourceType = @ SourceType
最多返回500行。
并更新状态为1
我有应用程序,它调用此SP,如何阻止
同时调用相同的SP来获取相同的行?
目前还不清楚,您希望其他人返回什么?
如果你想要LOCK那个选择语句 SQL Server提供了各种各样的隔离级别;选择那个提供数据消费者需要的保证和行为的b / b
https://docs.microsoft.com/en-us/previous-versions/sql/sql-server-2008-r2/ms189122(v = sql.105) 跨度>
i have SP, which take data from few tables.
my main column are status :
0 -not updated
1- in progress
2- finished
and SourceType (can be 1 to 100
when i put the data i do
select top 500.....
where status=0 and SourceType=@SourceType
which return up to 500 rows.
and update the status to 1
i have applications, which call this SP, how can i prevent applications that
call the same SP at the same time to get the same rows?
It is unclear, what do you want the others return?
If you want to LOCK that select statement SQL Server provides a wide variety of isolation levels; choose the one that provides the guarantees and behaviours your data consumers need
https://docs.microsoft.com/en-us/previous-versions/sql/sql-server-2008-r2/ms189122(v=sql.105)
这篇关于几个应用程序在同一个表和值上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!