May 21, 2009 at 10:55 pm
DECLARE @Dummy int
SELECT @Dummy = COUNT(*) FROM [dbo].[FundingRate] WITH (UPDLOCK)
/* Note: LoadOne should load DELETED row, for delete action*/
/*LoadAll should load LIVE rows*/
/*Metadata which specifies how this data should be aggregated*/
SELECT 'FundingRate' AS EntityType, 'FundingRate' AS Component
/*Domain object Data*/
SELECT FundingRateId,
CurrencyCode,
InterestRateId,
StartDate,
EndDate,
FundingRateStatus,
CreatedDateTime,
CreatedBy,
ModifiedDateTime,
ModifiedBy,
DeletedDateTime,
DeletedBy,
Version
FROM [dbo].[FundingRate]
WHEREFundingRateStatus = 'LIVE'
ORDER BY CurrencyCode,StartDate
Actually this is my sp where UPDLOCk IS used.
When it is required to apply locks in every fields of the table?
May 22, 2009 at 3:32 am
Why are you applying an update lock on the count? An update lock is usually used to indicate that the data selected will shortly be updated.
What are you trying to do?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply