if(@ShipDate2 IS NOT NULL AND @ShipDate2 <> "") BEGIN SET @Where = @Where+ " AND DATEDIFF(S,A.出荷日時,"+@ShipDate2+")>0" END