If you run a while loop from SSMS, the results won't come back immediately, even if you're using a PRINT. This is a clever way to return it immediately.
DECLARE @startdate DATETIME,
@now DATETIME,
@msg NVARCHAR(50)
SET @now = GETDATE()
SET @startdate = GETDATE()- 60
WHILE (@startdate
<= @now)
BEGIN
SET
@msg = (select CONVERT(VARCHAR(10), @startdate, 101))
RAISERROR (@msg, 0, 1) WITH NOWAIT
SET @startdate =
@startdate + 1
END
2 comments:
you are great...i have never seen such a compilation of workaround and smart tips...hats Off...really indebted !
Good Tip
-- SQL God
Post a Comment