隨筆-4  評論-0  文章-0  trackbacks-0
          select  isnull(convert(numeric(10,2), round(convert(numeric(10,0),x.ocr_file_num)/x.file_num * 100,2)),0) 
          from (select sum(total_file_num) as file_num,sum(auto_file_num) as ocr_file_num 
          from ws_ocr_report noholdlock 
          where tr_date>= '2012-03-31' and tr_date <='2012-03-31')x

          numeric(10,0) 10位數(shù)字 小數(shù)點(diǎn)后0位 ;
          convert(numeric(10,0),x.ocr_file_num) 把x.ocr_file_num 轉(zhuǎn)為小數(shù)點(diǎn)后0位的10位數(shù)字;
          round(a,b) 保留數(shù)字a小數(shù)點(diǎn)后b位小數(shù);


          select x.imp_type imp_type,isnull(y.un_auidted_num,0) un_auidted_num from 
          (select imp_type from imp_audit_type noholdlock where disp_sign=0 and tree_type=0 )x,(select imp_type,count(1) as un_auidted_num from imp_result noholdlock  where 1=1 
           group by imp_type)y
            noholdlock  where x.imp_type *= y.imp_type order by x.imp_type
          等價(jià)于
          select x.imp_type imp_type,isnull(y.un_auidted_num,0) un_auidted_num from 
          (select imp_type from imp_audit_type noholdlock where disp_sign=0 and tree_type=0 )x left join (select imp_type,count(1) as un_auidted_num from imp_result noholdlock  where 1=1 
           group by imp_type)y
            noholdlock  on x.imp_type = y.imp_type order by x.imp_type
          where x.imp_type *= y.imp_type order by x.imp_type 相當(dāng)于使用join的on條件;

          通過在 select 或 readtext 命令中將 holdlock、noholdlock 和 shared 選項(xiàng)應(yīng)用到單個(gè)表來替換某個(gè)會(huì)話的鎖定級別:
          使用級別    關(guān)鍵字        作用
          1             noholdlock  直到事務(wù)結(jié)束再持有鎖;在級別 3 使用以強(qiáng)制執(zhí)行級別 1
          2, 3         holdlock      持有共享鎖直到事務(wù)完成;在級別 1使用以強(qiáng)制執(zhí)行級別 3
          無            shared        在為更新操作打開游標(biāo)時(shí),對 select語句應(yīng)用共享鎖而非更新鎖

          批處理:
            bcp db..ds_aptr in f:/ftproot/dataSource/20120418\ABIS-APTR-1G-20120418 -e E:\DataManager\error\ds_aptr20120418.txt -c -t"|!" -r"\n" -Uad -Shn -Pbj -Jcp936 -b10000
          ds_aptr數(shù)據(jù)表  in導(dǎo)入 f:/ftproot/dataSource/20120418\ABIS-APTR-1G-20120418
          -e E:\DataManager\error\ds_aptr20120418.txt 錯(cuò)誤日志
          -t"|!" 以|!為列的分隔符
          -r"\n" 以\n為一條數(shù)據(jù)的分隔符
          -Uad 用戶名ad
          -Shn 服務(wù)器hn
          -Pbj 密碼bj
          -Jcp936 編碼cp936
          -b10000 分批10000條提交

           
          posted on 2012-04-19 17:33 cuilihui 閱讀(492) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 依安县| 柯坪县| 南宫市| 安岳县| 三穗县| 吴江市| 小金县| 白山市| 洪湖市| 墨竹工卡县| 荃湾区| 新余市| 平潭县| 兰考县| 肥城市| 南安市| 包头市| 海城市| 双鸭山市| 卢湾区| 威宁| 萨嘎县| 铅山县| 浑源县| 温泉县| 新宁县| 宁波市| 盐边县| 六安市| 聂荣县| 昆山市| 临澧县| 当雄县| 高淳县| 怀化市| 修文县| 札达县| 临潭县| 新河县| 溧阳市| 青田县|