Anda dapat menggunakan %s
sebagai parameter substitusi string di RAISERROR
:
DECLARE @PromoStartTimestamp DATETIME
DECLARE @PromoStartTimestampString VARCHAR(50)
SELECT @PromoStartTimestamp = PromoStartTimestamp From @promo
SELECT @PromoStartTimestampString = CAST(@PromoStartTimestamp AS VARCHAR)
If (@timestamp < @PromoStartTimestamp)
RAISERROR(N'Code not valid until %s'
,16
,1
,@PromoStartTimestampString);