Author: Charles

  • Alter index enable index disable index

    USE AdventureWorks
    GO
    —-Diable Index
    ALTER INDEX [IX_StoreContact_ContactTypeID] ON Sales.StoreContact DISABLE
    GO
    —-Enable Index
    ALTER INDEX [IX_StoreContact_ContactTypeID] ON Sales.StoreContact REBUILD
    GO
    —-Diable Index
    ALTER INDEX [IX_cid] ON Sales.StoreContact DISABLE
    GO
    —-Enable Index
    ALTER INDEX [IX_StoreContact_ContactTypeID] ON Sales.StoreContact REBUILD
    GO
  • [MySQL,windows] 작업스케줄러를 이용한 MySQL백업 및 데이터 삭제

    [MySQL,windows] 작업스케줄러를 이용한 MySQL백업 및 데이터 삭제
    1.MySQL의 데이터베이스를 매월 첫번째 일요일 오전 00:01분에 백업하는 예제
      1-1. 스케줄러 등록 커멘드
    SCHTASKS /Create /SC MONTHLY /MO first /D SUN /ST 00:01 /TN MySQL_BackUp /TR D:\db_bakup\bakup.bat
     [풀이]
      /Create : 스케줄러 신규
      /SC MONTHLY : 매월
      /MO fist : 첫번째
      /D SUN : 일요일
      /ST 00:01 : 스타트 시간은 오전00:01분
      /TN MySQL_BackUp : 스케줄러 이름
      /TR D:\db_bakup\bakup.bat : 실행할 프로그램의 경로 및 파일 이름
      1-2.bakup.bat 배치파일 내용
    @echo off
    echo Start Bakup…
    mysqldump -u사용자명 -p비밀번호 –result-file=”D:\db_bakup\backup.%date%.sql” 데이터베이스명
    echo End Bakup…
    2.위에서 백업을 한후 현시점으로해서 1개월 이전의 데이터를 매월 첫번째 일요일 오전 00:10분에 지우기 예제
      2-1. 스케줄러 등록 커멘드
    SCHTASKS /Create /SC MONTHLY /MO first /D SUN /ST 00:10 /TN MySQL_Delete /TR D:\db_bakup\data_del.bat
    [풀이]
    1.번과 동일
      2-2. data_del.bat 배치파일 내용
    mysql -u유저ID -p유저패스워드 데이터베이스명 -e “delete from 테이블명 where 날짜컬럼 <= date_sub(curdate(), INTERVAL 1 MONTH);”
     [풀이]
    -e “delete from 테이블명 where 날짜컬럼 <= date_sub(curdate(), INTERVAL 1 MONTH);”
    : 실행 시킬 커맨드
  • n 주 후의 해당주 마지막 요일 및 날짜 구하기

    javascript
    n 주 후의  해당주  마지막 요일 및 날짜 구하기
    <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
    <html>
     <head>
      <title> New Document </title>
      <meta name=”Generator” content=”EditPlus”>
      <meta name=”Author” content=””>
      <meta name=”Keywords” content=””>
      <meta name=”Description” content=””>
      <script type=”text/javascript”>
      <!–
    function DateFormat(obj) { //날짜를 YYYYMMDD 형식으로 변경하는 함수
                //Year
                var yy = obj.getYear();
                //Month
                if (String(obj.getMonth() + 1).length == 1) {
                    var mm = “0” + (obj.getMonth() + 1);
                }
                else {
                    var mm = obj.getMonth() + 1;
                }
                //Day
                if (String(obj.getDate()).length == 1) {
                    var dd = “0” + obj.getDate();
                }
                else {
                    var dd = obj.getDate();
                }
                var date = String(yy) + “-” + String(mm) + “-” + String(dd);
                return date;
            }
    function LicenceToOccupy(acceptCompletionDate, wk)
    {
    var parts = acceptCompletionDate.split(“-“);
    var date1 = new Date(parts[0], (parts[1] – 1), parseInt(parts[2]) + 7*(wk-1)); //month 0 based, day: parse to int and increment 14 (2 weeks)
    //return date1.toLocaleDateString(); //if the d/m/y format is the local string, otherwise some cusom formatting needs to be done
    return date1;
    }
    var a = LicenceToOccupy(‘2015-10-01’,2);
    var s = DateFormat(a);
    var oss = s.replace(/-/g,”);
    var idate = oss; //기준일
            var intDayCnt1 = 0;
            var intDayCnt2 = 0;
    function get_Date(obj) { //월요일 ~ 일요일 구하기
                var year = obj.substring(0, 4);
                var month = obj.substring(4, 6);
                var day = obj.substring(6, 8);
                var week = new Array(“일”, “월”, “화”, “수”, “목”, “금”, “토”);
                var vn_day1 = new Date(year, month – 1, day);
                var i = vn_day1.getDay(); //기준일의 요일을 구한다.( 0:일요일, 1:월요일, 2:화요일, 3:수요일, 4:목요일, 5:금요일, 6:토요일 )
                if ((i > 0) && (i < 7)) { //기준일이 월~토 일때
                    intDayCnt1 = 1 – i;
                    intDayCnt2 = 7 – i;
                }
                else if (i == 0) {  //기준일이 일요일일때
                    intDayCnt1 = -6;
                    intDayCnt2 = 0;
                }
                //기준일의 주의 월요일의 날짜와 토요일의 날짜
                var Cal_st = new Date(vn_day1.getYear(), vn_day1.getMonth(), vn_day1.getDate() + intDayCnt1);
                var Cal_en = new Date(vn_day1.getYear(), vn_day1.getMonth(), vn_day1.getDate() + intDayCnt2);
    //기준일 주의 마지막 해당 요일(첫주의 마지막 요일과 동일)  6:토요
    var Cal_last = new Date(vn_day1.getYear(), vn_day1.getMonth(), vn_day1.getDate() + intDayCnt1+(6-1));
                //날짜표시형식 첫번째 (예: 2008년 5월 1일)
                // var st_day = Cal_st.getYear()+”년 “+(Cal_st.getMonth()+1)+”월 “+Cal_st.getDate()+”일 “+ week[Cal_st.getDay()]+”요일”;
                // var en_day = Cal_en.getYear()+”년 “+(Cal_en.getMonth()+1)+”월 “+Cal_en.getDate()+”일 “+ week[Cal_en.getDay()]+”요일”;
                //날짜표시형식 두번째 (예: 20080501)
                var st_day2 = DateFormat(Cal_st);
                var en_day2 = DateFormat(Cal_en);
                //br = ‘<BR>’;
                //document.write (“기준일 : ” + obj + br);
                //document.write (“시작일(월) : ” + st_day + ” (” + st_day2 + “)” + br);
                //document.write (“종료일(일) : ” + en_day + ” (” + en_day2 + “)” + br);
                document.frmDate.txtSDate.value = st_day2;
                document.frmDate.txtEDate.value = DateFormat(Cal_last);
            }
      //–>
      </script>
     </head>
     <body>
      <form name=”frmDate”>
      <input type=”text” name=”txtSDate” value=””>
       <input type=”text” name=”txtEDate” value=””>
      </form>
     </body>
    </html>
    <script type=”text/javascript”>
    <!–
    //get_YesDate();
    get_Date(idate);
    //–>
    </script>
  • about fall

    가을 가을 이맘때쯤 그냥 이제는 가을은 다른 가을은 있다 @@
    아마도 오늘이라면 가을을 만난 것 같다
    작은 눈망울이 아주 크게 보여요 내 눈도 박제된 얘기를 꺼내고 싶다 가을은 두른두른 마른다
  • 통신사 DNS  

     [SK브로드밴드]
    기본 DNS서버 : 219.250.36.130
    보조 DNS서버 : 210.220.163.82
    [KT olleh 구-QOOK쿡 ]
    기본 DNS 서버 : 168.126.63.1
    보조 DNS 서버 : 168.126.63.2
    [LG U+ 구-파워콤 DNS]
    기본 DNS : 164.124.101.2
    보조 DNS : 203.248.252.2