日期:2014-05-17 浏览次数:20431 次
select * from (
SELECT CONVERT(datetime, SUBSTRING(shengfenNum, 7, 4) + '/' + SUBSTRING(shengfenNum, 11, 2) + '/' + SUBSTRING(shengfenNum, 13, 2),111) AS '出生日期'
FROM Relation
where
ISDATE( SUBSTRING(shengfenNum, 7, 4) + '/' + SUBSTRING(shengfenNum, 11, 2) + '/' + SUBSTRING(shengfenNum, 13, 2))>0
) as tab1
where 出生日期 < '2011-1-1 '
SELECT CONVERT(datetime, SUBSTRING(shengfenNum, 7, 4) + '/' + SUBSTRING(shengfenNum, 11, 2) + '/' + SUBSTRING(shengfenNum, 13, 2),111) AS '出生日期'
into #tab1
from Relation
where
ISDATE(SUBSTRING(shengfenNum,7,4)+'/'+SUBSTRING(shengfenNum,11,2)+'/'+SUBSTRING(shengfenNum,13,2))>0
select * from #tab1
where 出生日期 < '2011-1-1 '