Colorful Life

世上没有停下的路,停下的只是人的脚步~
View my W3 Compliant Sites validate xhtml 1.1 validate css2.0

jQuery FCKeditor Python ColdFusion SQL ASP CSS 数据库 服务器 Google

Total:518 | Page:1/74 | PageSize:7 | 1 [2] [3] [4] [5]
diary mood
DB2的SQL将日期时间转化为数字串
[ Pubdate:2008-8-18 Monday ] [ Weather:暴雨没下下来 ]

DB2中没有TO_CHAR函数,所以要将系统时间转化成字符串甚至是数字串的话,没有什么特别好的方法,但方法还是有的,虽然麻烦点。

INSERT INTO
LCDFLIB.FMOS01P(OSINPD,OSUSER,OSRKCD,OSSTRD,OSENDD,OSOSNI,OSCRDT,OSCRTM,OSCRTA)
 VALUES(
(CAST (SUBSTR(CHAR(current timestamp),1,4) || SUBSTR(CHAR(current timestamp),6,2)||
 SUBSTR(CHAR(current timestamp),9,2) || SUBSTR(CHAR(current timestamp),12,2) ||
 SUBSTR(CHAR(current timestamp),15,2) || SUBSTR(CHAR(current timestamp),18,2) AS BIGINT)
),'TANAKA    ','K22  ',20080815,20080914,'LJASLDFJWOIEJFLSDKJFL',20080818,153251,'TANAKA    ')

思路为,用current timestamp取系统的日期时间,然后用char()转化为字符串,再用SUBSTR()取出其中的数字部分,联接,最后再用CAST()函数将日期的数字串转换成大数值型。

由于日期的数字串长达14位,所以integer即int32长度不够,只能转换成BIGINT或是Decimal这种高精度的才行。

比如在.NET当中,要用Decimal.TryParse()而不能用Integer.TryParse()

阅览全文... At:18:02:33 In:Database-数据库 Comment:0 Views:11
diary mood
加奥运班
[ Pubdate:2008-8-8 Friday ] [ Weather:热,RE,HOT,atui ]

8号,北京的所有机关和企事业单位放假一天,其实我们公司也是要放假的,因为奥运会。

而我,现在所在的。NET项目组却要加班,百年一遇,加个奥运班,哈哈。

不过今天 晚上是打死不能加班了,开幕式是肯定要看的了。

大连终于连续一周晴天了,不过也确实热了一周了,最难过的是中午吃饭的时候,吃得汁流夹背不说,还得忍受路上的太阳晒。

计划去厦门,现在这个项目一结束,就去,就去,就去,厦门,我来了,我来了,来了,来了。。。。

泥烘锅有两三个月没学,明显感觉到退步了,这些本来就没学好的东西,要忘记却是很容易的,看来还是要继续加油了。

以后要看泥烘网页,听泥烘歌,看泥烘剧,啊。。。。我亲爱的美剧,对不住了。

阅览全文... At:0:48:11 In:Mood-柠檬物语 Comment:6 Views:113
diary mood
sql之join用法完全版
[ Pubdate:2008-7-31 Thursday ] [ Weather:阴转中雨,东南风5-6级转南风5-6级,(21~26)℃ ]

SQL中大概有这么几种JOIN:

cross join

inner join

left outer join

right outer join

full outer join

 

首先都是基于cross join(笛卡尔乘积),然后是inner join,在笛卡尔乘积的结果集中去掉不符合连接条件的行。

 

阅览全文... At:14:16:56 In:Database-数据库 Comment:2 Views:73
diary mood
本本秀
[ Pubdate:2008-7-24 Thursday ] [ Weather:多云,北风4-5级,(20~27)℃ ]

阅览全文... At:23:23:48 In:Mood-柠檬物语 Comment:5 Views:155
diary mood
一条SQL语句,字段联接
[ Pubdate:2008-7-22 Tuesday ] [ Weather:晴转多云,南风4-5级,(22~29)℃ ]

select spnumber || '-' || scNumber from dba.ast_scNumber where datediff(day,recTime,'2008/7/5')=0

再补一个

DB2中对应的select top n在DB2中对应的语法是
select * from tablea fetch first n row only
--取last n就 order by id desc
阅览全文... At:17:16:56 In:Database-数据库 Comment:2 Views:133
diary mood
凉爽的金石发现王国
[ Pubdate:2008-7-14 Monday ] [ Weather:多云转大到暴雨,东南风4-5级转南风5-6级,(21~25)℃ ]

第三次了,已经是第三次去发现王国了。

第一次是前年刚开园的时候和小T去的,那时候人还不太多,但很多好玩的设施都没弄好。

第二次是今年4月和公司同事一起去的,玩了一直想玩的弹射式过山车——疯狂眼镜蛇还有直上直下极速升降的太空梭

阅览全文... At:22:54:48 In:Mood-柠檬物语 Comment:18 Views:274
diary mood
SQL中CASE的变态用法
[ Pubdate:2008-7-9 Wednesday ] [ Weather:雾转阵雨,东南风4-5级转南风4-5级,(20~25)℃ ]

where (case curRec when 1 then a.spnumber=b.spnumber else 1=1 end)

或是

where a.spnumber=b.spnumber and a.spnumber(case curRec when 1 then =b.spnumber else not is null end)

这两句都不好用,想了好几分钟,其它的条件下(不进行a.spnumber字段判断的情况下,让此字段=自己不就行了 :)

阅览全文... At:10:44:43 In:Database-数据库 Comment:0 Views:117
Total:518 | Page:1/74 | PageSize:7 | 1 [2] [3] [4] [5]

Blog Calendar

Blog Categories

Atom 1.0  Rss feed ver 2.0

Latest Feedback

Blog Friends

Site Stat.

  • Font Count:[142]
  • Blog Count:[602]
  • Work Count:[24]
  • PhotoCount:[128]
  • Link Count:[15]
  • Total Refresh:[2865082]
  • Total IP:[294357]
  • Today Refresh:[470]
  • Today IP:[100]