執行sql時,出現
Lookup Error - SQL Server Database Error: 將 varchar 資料類型轉換成 datetime 資料類型時,產生超出範圍的值。
可能原因是?
DECLARE @a DATETIME
SET @a = '0001/1/1 12:00:00'
DECLARE @b DATETIME
SET @b = '2020/7/7 23:59:00'
DECLARE @c DATETIME
SET @c = '2020/12/31 23:59:00'
DECLARE @d DATETIME
SET @d = '2020/7/7 12:00:00'
WHERE ( NOT (((CASE WHEN ([Filter1].[aa] IS NOT NULL) THEN [Filter1].[aa] ELSE @a END) > @b)
OR ((CASE WHEN ([Filter1].[bb] IS NOT NULL) THEN [Filter1].[bb] ELSE @c END) < @d)))