Posted by Joko ugar on 07/11/05 18:17
Razvan Socol wrote:
> I think you want something like this:
>
> BEGIN TRAN
> DECLARE @value int
> SELECT @value=YourColumn FROM TheTable WITH (TABLOCKX)
> SET @value=...
> UPDATE TheTable SET YourColumn=@value
> COMMIT
>
> But you should consider performing the modification directly in the
> UPDATE statement.
>
> Razvan
>
Might be... but I'm not sure that no one can read data from table
between SELECT and UPDATE. If you set isolation to dirty read than
you're able to read uncommited data, right?
Does "WITH (TABLOCKX)" lock the table until the end of transaction?
Navigation:
[Reply to this message]
|