# script: scripts/12b_waitfor_time_utc.sql | database: lab-cst | started (UTC): 2026-10-16 01:50:46 /* 12b - WAITFOR TIME with a UTC target 5 seconds ahead (CST database) Mirror of 12a: if WAITFOR TIME follows the Central setting, a UTC target is ~19 hours in the past/future and the runner's 30 s timeout fires; if it is UTC-based, this returns in ~5 s. */ SET NOCOUNT ON; PRINT '=== 12b WAITFOR TIME UTC target on ' + DB_NAME() + ' (effective tz: ' + CURRENT_TIMEZONE_ID() + ')'; DECLARE @target varchar(12) = CONVERT(varchar(12), DATEADD(SECOND, 5, GETUTCDATE()), 114); DECLARE @t0 datetime2(3) = SYSUTCDATETIME(); SELECT @target AS waitfor_target_utc, GETDATE() AS local_now, GETUTCDATE() AS utc_now; WAITFOR TIME @target; SELECT 'returned' AS result, DATEDIFF(MILLISECOND, @t0, SYSUTCDATETIME()) AS waited_ms; === 12b WAITFOR TIME UTC target on lab-cst (effective tz: Central Standard Time) waitfor_target_utc|local_now|utc_now ------------------|---------|------- 01:50:51:960|2026-10-15 20:50:46.960|2026-10-16 01:50:46.960 result|waited_ms ------|--------- returned|5011 PRINT '--- 12c WAITFOR DELAY is relative and unaffected'; DECLARE @t0 datetime2(3) = SYSUTCDATETIME(); WAITFOR DELAY '00:00:02'; SELECT 'WAITFOR DELAY 2s' AS test, DATEDIFF(MILLISECOND, @t0, SYSUTCDATETIME()) AS waited_ms; --- 12c WAITFOR DELAY is relative and unaffected test|waited_ms ----|--------- WAITFOR DELAY 2s|2001 # sqlcmd exit code: 0