【正文】
39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。,N39。)/*zuo zhong hua ren min gong he guo(1 行受影響)*/本文來自: 腳本之家() 詳細(xì)出處參考:MSSQL自動流水帳號的生成第二種方法(無自定義函數(shù))(日期表達(dá)式)將日期表達(dá)式轉(zhuǎn)換成日期類型的數(shù)據(jù)。日期表達(dá)式是任何可以解釋成日期的表達(dá)式,包含日期文字,可以看作日期的字符串以及從函數(shù)返回的日期。函數(shù)確定性DATEADD具有確定性DATEDIFF具有確定性DATENAME不具有確定性DATEPART除了用作 DATEPART (dw, date) 外都具有確定性。039。MA39。039。39。CDate 依據(jù)系統(tǒng)誅油伴愚綽癱攆吮獨抵護面判詐膨肇謬騎逼忿賺瑪?shù)跞殖裁袊u搗垃擻桂佃滴前傾熔峪席鼓慕嫩邁籮殉狀勁撫翁貴磊染巨啪若作挨饒臂徑妓20090527 15:(日期表達(dá)式)將日期表達(dá)式轉(zhuǎn)換成日期類型的數(shù)據(jù)。/********************************************************作者:(birdie_7761)版本:創(chuàng)建時間:20020227修改時間:功能:小寫金額轉(zhuǎn)換成大寫參數(shù):n_LowerMoney 小寫金額v_TransType 種類 1: directly translate, 0: read it in words輸出:大寫金額********************************************************/CREATE FUNCTION (n_LowerMoney numeric(15,2),v_TransType int)RETURNS VARCHAR(200) ASBEGINDeclare v_LowerStr VARCHAR(200) 小寫金額Declare v_UpperPart VARCHAR(200)Declare v_UpperStr VARCHAR(200) 大寫金額Declare i_I intset v_LowerStr = LTRIM(RTRIM(ROUND(n_LowerMoney,2))) 四舍五入為指定的精度并刪除數(shù)據(jù)左右空格set i_I = 1set v_UpperStr = 39。 THEN 39。 THEN 39。 THEN 39。 THEN 39。 THEN 39。 THEN 39。 THEN 39。 THEN 39。 THEN 39。 THEN 39。 THEN 39。WHEN 2 THEN 39。WHEN 4 THEN 39。WHEN 6 THEN 39。WHEN 8 THEN 39。WHEN 10 THEN 39。WHEN 12 THEN 39。WHEN 14 THEN 39。WHEN 16 THEN 39。ENDset v_UpperStr = v_UpperPart + v_UpperStrset i_I = i_I + 1endif ( 0 = v_TransType)beginset v_UpperStr = REPLACE(v_UpperStr,39。)set v_UpperStr = REPLACE(v_UpperStr,39。)set v_UpperStr = REPLACE(v_UpperStr,39。)set v_UpperStr = REPLACE(v_UpperStr,39。)set v_UpperStr = REPLACE(v_UpperStr,39。)set v_UpperStr = REPLACE(v_UpperStr,39。)set v_UpperStr = REPLACE(v_UpperStr,39。)set v_UpperStr = REPLACE(v_UpperStr,39。)set v_UpperStr = REPLACE(v_UpperStr,39。)set v_UpperStr = REPLACE(v_UpperStr,39。)set v_UpperStr = REPLACE(v_UpperStr,39。)set v_UpperStr = REPLACE(v_UpperStr,39。)set v_UpperStr = REPLACE(v_UpperStr,39。)set v_UpperStr = REPLACE(。,39。,39。,39。,39。,39。,39。,39。,39。,39。,39。,39。,39。,39。ELSE 39。WHEN 15 THEN 39。WHEN 13 THEN 39。WHEN 11 THEN 39。WHEN 9 THEN 39。WHEN 7 THEN 39。WHEN 5 THEN 39。WHEN 3 THEN 39。END+case i_IWHEN 1 THEN 39。WHEN 39。WHEN 39。WHEN 39。WHEN 39。WHEN 39。WHEN 39。WHEN 39。WHEN 39。WHEN 39。WHEN 39。while ( i_I = len(v_LowerStr))beginselect v_UpperPart = case substring(v_LowerStr,len(v_LowerStr) i_I + 1,1)WHEN 39。比如:myDate = CDate(99520) ,這樣的日期表達(dá)式必須加雙引號,否則結(jié)果不可預(yù)料。日期表達(dá)式是任何可以解釋成日期的表達(dá)式,包含日期文字,可以看作日期的字符串以及從函數(shù)返回的日期。039。MA39。039。DAY具有確定性GETDATE不具有確定性GETUTCDATE不具有確定性MONTH具有確定性YEAR具有確定性 現(xiàn)實生活中的流水帳號的格式有五花八門,本來主要探討一種比較普遍的格式2位字符串+4位年月日期+4位遞增數(shù)字(如MA2009090001),其他格式都不是問題。CDate 依據(jù)系統(tǒng)誅油伴愚綽癱攆吮獨抵護面判詐膨肇謬騎逼忿賺瑪?shù)跞殖裁袊u搗垃擻桂佃滴前傾熔峪席鼓慕嫩邁籮殉狀勁撫翁貴磊染巨啪若作挨饒臂徑妓 流水號對于流水賬單和登記表的作用尤為重要,看過網(wǎng)上多數(shù)版本都是在SQL SERVER寫的自定義函數(shù)來實現(xiàn)自動編號的,但是這樣有一個缺點,就是在插入記錄之前是沒有編號的,只有插入一條記錄后才自動生成一個編號。比如:myDate = CDate(99520) ,這樣的日期表達(dá)式必須加雙引號,否則結(jié)果不可預(yù)料。) twhere word = word collate Chinese_PRC_CS_AS_KS_WSorder by word ASC) else word end)set i = i + 1endreturn pinyinENDGOSELECT (39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。 漬唨union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。 鸈膶岃union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。 濎乭union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。 霯唞朰union all select 39。union all select 39。 討畓union all select 39。union all select 39。union all select 39。union all select 39。 躢襨union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。 瀃螦乺union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。 鰘齛兙瓧union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。 閪縇union all select 39。union all select 39。 裇聓union all select 39。union all select 39。union all select 39。union all select 39。 簺虄union all select 39。 櫒栍union all select 39。union all select 39。 橍挼union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。union all select 39。 羻兛瓩union all select 39。union all select 39。union a