20
這裏的正確語法是什麼?RAISERROR中的連接消息
If (@timestamp < (Select PromoStartTimestamp From @promo))
RAISERROR('Code not valid until ' + (Select PromoStartTimestamp From @promo)
,16
,1);
我已經試過:
If (@timestamp < (Select PromoStartTimestamp From @promo))
RAISERROR(N'Code not valid until @starttimestamp'
,16
,1
,(Select PromoStartTimestamp From @promo));
邁克爾·弗雷德裏克森的回答給我的Incorrect syntax near 'CAST'.
當我嘗試'Cast(@promostarttimestamp as varchar)'說的時候出現錯誤在'Cast'附近有錯誤的語法。期望選擇或('或當我不'Cast'我得到'不能指定日期時間數據類型(參數4)作爲替代參數。「 – Greg 2012-04-05 17:21:40
對於'%s'+1,但不能在表達式中使用表達式(CAST) RAISERROR參數,它必須是'RAISERROR'(N'Code無效,直到%s',16,1,@ PromoStartTimestampCastedToString));' – 2012-04-05 17:34:30
D'oh!感謝@RemusRusanu ...現在應該更好地工作。 – 2012-04-05 17:39:20