블로그 이미지
세피롯스

calendar

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

Notice

Tag

2010. 2. 24. 15:41 초보프로그래머만..

어떤내용을 디비에 저장할때 기존에 있는내용을 update할지 새로 저장할지 판단해야할때 쓰면 좋을듯..

-----------------------------------------------------------------------------------------
if not exists(select * from schedule_info_tbl where scDate = convert(datetime, '2010-02-26 13:22:11',120))

begin
 insert into schedule_info_tbl(scName,scDate)
 values('열심히', convert(datetime, '2010-02-26 13:22:11',120))
end
else
begin
 update schedule_info_tbl
 set scName = '열심히'
 where scDate = convert(datetime, '2010-02-26 13:22:11',120)
end

posted by 세피롯스