2007-10-08 15:46:22
| 分類:
開發語言小技巧
| 標籤:|舉報
|字型大小大中
小訂閱
一些常用的小技巧,以免自己不用會忘記。當作字典好了!
裡面包括一些sql語句和pb語法。
1、返回最後插入的標識值
@@identity
返回最後插入的標識值。自增字段。
下面的示例向帶有標識列的表中插入一行,並用 @@identity 顯示在新行中使用的標識值。
insert into jobs (job_desc,min_lvl,max_lvl)
values ('accountant',12,125)
select @@identity as 'identity'
2、下例用 *** 替換 abcdefghi 中的字串 cde。
select replace('abcdefghicde','cde','***')
3、查詢分析器帶引數執行儲存過程
exec udt_class_ufo_ckwkp_1[2000-01-01],[2004-5-1],[ select iid from u_dj_ckds]--,[@new_select output]
4、下面的示例查詢包含詞"bottles"且**為 $15.00 的所有產品。
use northwind
goselect productname
from products
where unitprice = 15.00
and contains(quantityperunit, 'bottles')
5、pb中日期變數用一種用法
if getcolumnname() = "csys_bz" then //用在enter事件中
//------------
" u_dj_ht.dht_date >= convert(datetime, '"+string(dw_ht.object.dht_date1[dw_ht.getrow()])+"')"
**注意mssqlserver函式convert用法,轉換為日期型變數
6、自動計算出出庫單對應通知單數量
select u_dj_ckds.iid,u_dj_ckds.ihts_id,u_dj_ckds.nsl,u_dj_ckds.mje ,t.nsl,t.mje,u_dj_ckds.nsl - t.nsl from u_dj_ckds inner join
(select ickds_id,sum(nsl) as nsl,sum(mje) mje from u_tzd_xxkps group by ickds_id) t on u_dj_ckds.iid = t.ickds_id;
7、用atediff計算入庫開票天數
select u_dj_jxfp.iid as jxfpid, u_dj_jxfps.iid as jxfpsid, datediff(day, u_dj_rkd.drkd_date, u_dj_jxfp.dinput_date) as rkdays, u_dj_jxfps.mje as jxfpje from u_dj_jxfp,u_dj_jxfps, u_dj_rkd, u_dj_rkds where ( u_dj_rkds.ihead_id = u_dj_rkd.iid ) and ( u_dj_jxfps.ihead_id = u_dj_jxfp.iid ) and ( u_dj_jxfps.irkds_id = u_dj_rkds.iid )
8、統計指定客戶回款數
select u_dj_hks.mje as hksje ,u_dj_hks.ixxfps_id as xxfpsid ,u_dj_hks.iid as hksid from u_dj_hks where ixxfps_id in(select iid from u_dj_xxfps where ihead_id in(select iid from u_dj_xxfp where iclient_id in(select ihead_id from u_xt_client_jc where iid = 2 )))
9、根據jxfp_id查詢到入庫開票天數
select sum(s.rkdays *(s.jxfpsje / a.jxfpje)) from (select sum(mje) as jxfpje,ihead_id as jxfpid from u_dj_jxfps group by ihead_id) a,(select u_dj_jxfp.iid as jxfpid, u_dj_jxfps.iid as jxfpsid, datediff(day, u_dj_rkd.drkd_date, u_dj_jxfp.dinput_date) as rkdays, u_dj_jxfps.mje as jxfpsje from u_dj_jxfp,u_dj_jxfps, u_dj_rkd, u_dj_rkds where ( u_dj_rkds.ihead_id = u_dj_rkd.iid ) and ( u_dj_jxfps.ihead_id = u_dj_jxfp.iid ) and ( u_dj_jxfps.irkds_id = u_dj_rkds.iid ) ) s where a.jxfpid = s.jxfpid
10、統計出超出多少時間的出庫數量
select u_dj_hts.iid as htsid, u_dj_ckds.iid as ckdsid, datediff(day, u_dj_ckd.dckd_date, convert(datetime, '2004/04/10')) as ckdays, u_dj_ckds.mje as jxfpje from u_dj_ht,u_dj_hts, u_dj_ckd, u_dj_ckds where ( u_dj_ckds.ihead_id = u_dj_ckd.iid ) and ( u_dj_hts.ihead_id = u_dj_ht.iid ) and ( u_dj_ckds.ihts_id = u_dj_hts.iid ) and datediff(day, u_dj_ckd.dckd_date, convert(datetime, '2004/04/10')) > u_dj_ht.ibest_arrearage_day and u_dj_ckd.idatalx = 0 and u_dj_ckd.idatalxs = 0 and u_dj_ckd.iclient_id in(select ihead_id from u_xt_client_jc where iid = 2 )
11、判斷許可權語法的一種用途
select iczy_id from u_xt_czy where substring(cczy_qx,31,1) = '1'
12、得到列的顯示值
string msg
msg = dw_data.describe("evaluate('lookupdisplay(izb_id)',"+string(il_row)+")")
messagebox("",msg)
13、match用法
match(gettext() , "^[a-z]+$")
match(gettext() , "^[0-9\-]+$") '**號碼只能為 0-9 的數字或 - 組成!'
match(gettext() , "^[0-9]+$") '郵編只能為 0-9 的數字組成!'
14、pb中快速刪除多行記錄
準確的說是移動行,同理函式還有rowscopy
dw_fdbl.rowsmove(1, dw_fdbl.rowcount(), primary!, dw_fdbl, 1, delete!)
Android 開發常用小技巧
檢視手機所有資訊 2846579 檢視 apk 清單檔案資訊 aapt dump badging apk adb shell am start n 檢視指定應用 log linux 平台下使用 adb shell ps cut d f5 adb logcat grep adb 截圖 adb shel...
js開發中常用小技巧
function getradomnum min,max function getradomfromarr arr function getarray len 等同於 function getarray len console.log arr var arr 1,2,3,4,5,6,7,a dsfs...
APICloud開發小技巧(一)
apicloud開發文件中,前端開發框架指的就是,類似jq js的語法 1.安卓滑動關閉視窗 在ios裝置上可以通過滑動來關閉win,在安卓預設是不可以。細看下文件其實也很的簡單,監聽事件裡面的swiperight 如果乙個視窗是先開啟win再巢狀frame的開啟的方法如下 apiready fun...