MSSQL2008 특정기간 검색후 접속안한 계정 삭제 쿼리좀 바주세요
본문
MSSQL2008 특정기간 검색후 접속안한 계정 삭제 쿼리좀 바주세요
use naks
delete from warehouse
where accountid in (select memb___id from memb_stat where getdate()-isnull(connecttm,'2018/2/30')>20 and getdate()-isnull(disconnecttm,'2018/2/30')>20)
위에 mssql 쿼리문이 10년전에 쓰던건데 지금 쓸려고 하니 오류가 나네요 ..
---------------
메시지 242, 수준 16, 상태 3, 줄 2
varchar 데이터 형식을 smalldatetime 데이터 형식으로 변환하는 중 값 범위를 벗어났습니다.
문이 종료되었습니다.
---------------
입니다.
memb_stat 테이블의 시간 검색은
memb___id varchar(10)
ConnectStat tinyint
ServerName varchar(20)
IP varchar(15)
ConnectTM smalldatetime
DisConnectTM smalldatetime
입니다.
어떻게 고쳐야 할지좀 알려주시며 감사 하겠습니다 .
답변 1
select memb___id from memb_stat where getdate()-isnull(connecttm,'2018-2-30')>20 and getdate()-isnull(disconnecttm,'2018-2-30')>20