다음 일련번호 뽑기 mssql max() MSSQL

select case when max(convert(int,firstcode)) is null then
1
else
max(convert(int,firstcode)) + 1
end firstcode
from gbs_commoncode

코드관리샘플(MSSQL CTE sample) MSSQL

WITH cte
       (
           firstcode,
           secondcode,
           thirdcode,
           fourthcode,
           codename
       ) as
       (SELECT firstcode,
              secondcode,
              thirdcode,
              fourthcode,
              codename
         FROM gbs_commoncode
        WHERE secondcode = 0
              AND thirdcode = 0
              AND
              (
                  fourthcode = 0
                  OR fourthcode is null
              )
           UNION ALL
       SELECT p.firstcode,
              p.secondcode,
              p.thirdcode,
              p.fourthcode,
              p.codename
         FROM gbs_commoncode c,
              cte p
        WHERE p.firstcode = c.firstcode
       )
SELECT firstcode,
       secondcode,
       thirdcode,
       fourthcode,
       codename
  FROM gbs_commoncode
ORDER BY convert(int,replace(isnull(firstcode,'0'),',','')) asc,
       convert(int,replace(isnull(secondcode,'0'),',','')) asc,
       convert(int,replace(isnull(thirdcode,'0'),',','')) asc,
       convert(int,replace(isnull(fourthcode,'0'),',','')) asc

firewall for sqlserver2008R2 on wondows2008R2 MSSQL


tomcat6 on SBS 2011(windows2008R2) jsp

1.Download apache-tomcat-6.0.30-windows-x64 version.
 2.Extract to c:\Tomcat6
 3.open command prompt run as Adminstrator
 4.and go to Tomcat6\bin directory and run from command prompt>service install
 5.Tomcat6 will install as Windows Service.
 6.again go to Tomcat6\bin and open tomcat6w.exe run as administrator and modify your changes.
 7.it works cool.

use port 80

    <Connector port="80" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />


use domain(/conf/server.xml)

      <Host name="your domain"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
 </Host>

      <Host name="yourdomain"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
 </Host>

if you use sbs2011..(already use port 80)
sql report stop on service
iis stop on iis manager


visualstudio 2010 debug in a fixed port C#

open properties window of Solution Explorer

select a 'Web' tab

check a Specific port in 'Server' section

done.


group by 조건절(having) Oracle

group by 조건절 having

Sample :
SELECT DEPT_NO, AVG(AMOUNT)
        FROM DEPT_SALES
        WHERE AMOUNT > 100
        GROUP BY DEPT_NO
        HAVING AVG(AMOUNT) > 200;


flash over a div(플래시 위로 Layer 올라오게 함) JavaScript


add flash tag option :
  <param name="wmode" value="transparent">

selectbox sort(combobox sort) JavaScript


function sortlist(obj)
{
 var arrTexts = new Array();

 for(i=0; i<obj.length; i++) 
 {
   arrTexts[i] = obj.options[i].text;
 }

 arrTexts.sort();

 for(i=0; i<obj.length; i++) 
 {
   obj.options[i].text = arrTexts[i];
   obj.options[i].value = arrTexts[i];
 }
}


객체의 좌표 구하기(How to get an Object coordinates) 미분류

    function getBounds( obj ) {
   var ret = new Object();

   if(document.all) {
    var rect = obj.getBoundingClientRect();
    ret.left = rect.left + (document.documentElement.scrollLeft || document.body.scrollLeft);
    ret.top = rect.top + (document.documentElement.scrollTop || document.body.scrollTop);
    ret.width = rect.right - rect.left;
    ret.height = rect.bottom - rect.top;
   } else {
    var box = document.getBoxObjectFor(obj);
    ret.left = box.x;
    ret.top = box.y;
    ret.width = box.width;
    ret.height = box.height;
   }

   return ret;
  }

[Use]
  function getThisCoordi() {
   var obj = getBounds( document.getElementById("testBtn") );

   alert( "left : " + obj.left + ", top : " + obj.top + ", width : " + obj.width + ", height : " + obj.height );
  }

출처 : http://blog.naver.com/devstory/130038823596


use row_number() on mssql 2005 MSSQL

Example >>
select * from
(select Row_Number() Over( order by njubsu_id desc, ngamjung_id asc) rownum, *
  from vw_requestidentitification_list) a
  where rownum between 11 and 20

1 2 3 4 5 6 7 8 9 10 다음