제가 아래와 같이 나이를 구하는 뷰를 만든 다음에요.
create view custom_age_view
as
select 'custom_cd' = custom_cd,
'age' = datediff(yy, convert(datetime, birth_dt), getdate()),
'birth_dt' = birth_dt
from tbl
where isnull(birth_dt, '') != ''
and datalength(birth_dt) = 8
and substring(birth_dt, 1, 4) >= '1900'
and substring(birth_dt, 5, 2) >= '01'
and substring(birth_dt, 5, 2) <= '12'
생성 한 뷰를
select * from custom_age_view where age between 0 and 99 이렇게 했는데
'Arithmetic overflow during explicit conversion of VARCHAR value '19408010' to a DATETIME field '
이런 에러가 나드라구요.
birth_dt이 칼럼에 값이 틀리게 입력된게 있어서 걸를여구 뷰를 만든건데 에러가 나드라구요
해결할 수 있는 방법이 있을까요?
|