Hi experts,
I retrieve data remotely through a linked server and i want to get the time it takes. This is what I thought I would use:
DECLARE @MyMessage VARCHAR(100)
DECLARE @StartTime VARCHAR(25)
DECLARE @StopTime VARCHAR(25)
SET @StartTime = SELECT GETDATE()
....retrieve data from my linked server...
SET @StopTime = SELECT GETDATE()
SET @MyMessage = 'Retrieve time: ' + DATEDIFF(mi, @StartTime, @StopTime)
This just doesn't work. QueryAnalyzer tells me there is "Incorrect syntax near the keyword 'SELECT'." SELECT GETDATE() works fine on its own. What do I have to do different?
Thank you and
Warm regards,