I had a look at the locks (lockx etc) I think this will
not guarantee me the exclusivety so will have to move my
truncate and insert statements together to make a proper
Thanks everybody for their replies.
>There is locking hint which you can specify for select
>insert update and delete statements in transaction which
>will override the current isolation level.
>Note: use it with care try not to use it in a deployment
>environment because you may affect the isolation levels
>for on going transaction
>Go to SQL server books on line and check for information
>>I have the following situation
>>create proc test
>>truncate table A
>>insert into table #B
>>more calculations etc...
>>insert into table A
>>Now the problem is I have another process which reads>>table A but because the above stored procedure takesblank>>that means because the table is truncated and takes a
>>while to be re-populated the second process reads a>.>>table sometimes!!
>>Is anyway I can specify a lock so if a table is being
>>updated in a stored proc it will wait for it? I don't
>>think I can use begin and commit tran to lock the table
>>and cannot move the truncate just before the data insert
>>cause there are more blocks of if statements.
>>Any other ideas?