Erland Sommarskog
2003-08-13 20:45:01 UTC
[posted and mailed, please reply in news]
BEGIN TRANSACTION
SELECT @dummy = COUNT(*) FROM tbl WITH (INDEX = 0, TABLOCK, UPDLOCK)
will do the trick for you.
However, this is probably not a good solution to your actual problem.
MS SQL Server and Oracle are two very different beasts, and trying to
program SQL Server as if it was Oracle is no road to success.
If you provide details about your actual business problem, you may get
better suggestions.
Does exist command in the MSSQL that is the same like ORACLE command
LOCK TABLE ee IN EXCLUSIVE MODE NOWAIT; ?
In the concrete, during transaction (where is this command used) other
users
-can read from table EE and result is status before transaction begining
-cannot modify table EE (neither INSERT nor DELETE nor UPDATE)
-cannot start the same transaction and get immediatelly information about
it
It is possible thatLOCK TABLE ee IN EXCLUSIVE MODE NOWAIT; ?
In the concrete, during transaction (where is this command used) other
users
-can read from table EE and result is status before transaction begining
-cannot modify table EE (neither INSERT nor DELETE nor UPDATE)
-cannot start the same transaction and get immediatelly information about
it
BEGIN TRANSACTION
SELECT @dummy = COUNT(*) FROM tbl WITH (INDEX = 0, TABLOCK, UPDLOCK)
will do the trick for you.
However, this is probably not a good solution to your actual problem.
MS SQL Server and Oracle are two very different beasts, and trying to
program SQL Server as if it was Oracle is no road to success.
If you provide details about your actual business problem, you may get
better suggestions.
--
Erland Sommarskog, SQL Server MVP, ***@algonet.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp
Erland Sommarskog, SQL Server MVP, ***@algonet.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp