블로그 이미지
010-9967-0955 보미아빠

카테고리

보미아빠, 석이 (500)
밥벌이 (16)
싸이클 (1)
일상 (1)
Total
Today
Yesterday

달력

« » 2024.4
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30

공지사항

최근에 올라온 글

현재까지 no_merge, no_push_pred 라는 힌트는 sql 에서 지원되지 않는다.
아직 멀었다. 아직 어린이 티가 팍팍 나지 않는가?
착한 어린이 mssql 2011 denali 이렇게 선전하면 좋을듯..........

개인적으로 mssql query hint 는 정말 꼬질 꼬질하고 다른 DBMS와 비교해 아주 신생아 수준인거 같음......
force seek force scan 나오지만 이런 기본적인게 안된다.......-_- 생각을 바꾸어 봐야 하나....
바꾸어도 용서가 안되는데.........바봉~ 이렇게 멍청하고 한 우물만 파는 바보들이 있으니 내가 밥 먹고 살겠지......
감사합니다. mssql 님....^-----^;


if object_id('ttt') is not null
drop table ttt
go

;with test
as (
select '19800101' birth,'20110101' today union all
select 'asdf' birth ,'20110101' today
)
select *
into ttt
from test
go

select * 
  from (select birth , today
    from ttt
   where isdate(birth)=1
     and isdate(today)=1 )a
 where datediff(yy,cast(birth as datetime),cast(today as datetime)) > 30
go

-- 위 쿼리는 당연히 돌아야 할 것 같은 쿼리이지만 돌아가지 않는다.
-- view predicate merge issue 를 모르면 당연한 이야기 이다.
-- 이것만 책으로 100장이 넘게 설명한 책도 있다.

--단순하게 아래와 같이 수정해 보자

select birth, today  
  from (select top 100000000000 birth, today
    from ttt
   where isdate(birth)=1
     and isdate(today)=1 )a
 where datediff(yy,cast(birth as datetime),cast(today as datetime)) > 30 
 


 -- 잘 돌아가지요? 해당 이슈에 대해서는 스터디때 설명해 드리겠습니다. 
 
스터디 모집 광고는 다음을 참고 하세요~
어디 성욱이가 잘 정리해 둔게 있었는데....어디쥐......

http://cafe.naver.com/sqlmvp/1148 일단 이거 참고요~

Posted by 보미아빠
, |

최근에 달린 댓글

최근에 받은 트랙백

글 보관함