I have a view:
That only gets items that have a valid date. Querying the view shows that only valid dates are there...
But if I have a query that does a date comparison in the where clause (example)
This query bombs if any of the users dates in the original table are either blank, or partial (we allow entry of date parts in 3 form fields, then we put them back together)
Code:
CREATE VIEW table_view
AS SELECT USERID, LEOTYP, LEONUM, LEOST, ACTIVE_FLAG
, CAST(LEOEXM + '/' + LEOEXD + '/' + LEOEXY AS DATETIME) AS EXPIRES
FROM table
WHERE ISDATE(LEOEXM + '/' + LEOEXD + '/' + LEOEXY) = 1
GO
But if I have a query that does a date comparison in the where clause (example)
Code:
select USERID, LEOTYP, LEONUM, LEOST, ACTIVE_FLAG, EXPIRES
from table_view
where USERID = 13549 and EXPIRES <= '12/30/2005'