my SQL studio view is running into timeout error block. how do i insert the
SET LOCK_TIMEOUT -1GO
in the SQL statement of the view to allow this to run to completion? an example of the SQL view is;
SELECT TOP (100) PERCENT dbo.Entry_Race.E_TDR, dbo.Entry_Race.E_Surface, dbo.Entry_Race.E_Race_Class_Codes,
FROM dbo.Entry_Race INNER JOIN
dbo.Entry_Horse ON dbo.Entry_Race.E_TDR = dbo.Entry_Horse.E_TDR
WHERE (CONVERT(varchar(07), dbo.Entry_Horse.E_Date) BETWEEN CONVERT(varchar(07), GETDATE(), 0) AND CONVERT(varchar(07), GETDATE() + 1, 0))
ORDER BY dbo.Entry_Race.E_TDR, dbo.Entry_Horse.E_Horse, dbo.Entry_Horse.E_Traininer
Do you really need to wait indefinitelly? It is not a very normal situation to have the client waiting tens of seconds for a response - why not using a more optimistic locking mechanism?
You shouldn't user the convert funcion to compare the dates, but using dateadd () over the getdate() functions and compare directly - as it is, any indexes over dbo.Entry_Horse.E_Date will not be used by SQL...
No comments:
Post a Comment