隨筆-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ù)點后0位 ;
          convert(numeric(10,0),x.ocr_file_num) 把x.ocr_file_num 轉(zhuǎn)為小數(shù)點后0位的10位數(shù)字;
          round(a,b) 保留數(shù)字a小數(shù)點后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
          等價于
          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 相當于使用join的on條件;

          通過在 select 或 readtext 命令中將 holdlock、noholdlock 和 shared 選項應(yīng)用到單個表來替換某個會話的鎖定級別:
          使用級別    關(guān)鍵字        作用
          1             noholdlock  直到事務(wù)結(jié)束再持有鎖;在級別 3 使用以強制執(zhí)行級別 1
          2, 3         holdlock      持有共享鎖直到事務(wù)完成;在級別 1使用以強制執(zhí)行級別 3
          無            shared        在為更新操作打開游標時,對 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導入 f:/ftproot/dataSource/20120418\ABIS-APTR-1G-20120418
          -e E:\DataManager\error\ds_aptr20120418.txt 錯誤日志
          -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)站導航:
           
          主站蜘蛛池模板: 双流县| 哈密市| 六安市| 宾川县| 泰州市| 浪卡子县| 景泰县| 丰原市| 开化县| 云浮市| 涞源县| 建瓯市| 都匀市| 田阳县| 丁青县| 巫溪县| 民丰县| 万山特区| 阳东县| 乐至县| 武冈市| 广东省| 潜江市| 平潭县| 阿坝| 沙坪坝区| 新兴县| 壶关县| 边坝县| 临邑县| 肃宁县| 白朗县| 宜阳县| 腾冲县| 汶上县| 琼海市| 双辽市| 庆云县| 岑巩县| 新营市| 嘉荫县|