标签:style color c int strong 2014
关于ID生成
注:today()和now()是date类型,如需转换,可用datetime(today(())和datetime(now())
一般用:SELECT sysdate INTO :ldt_sysDateTime
FROM DUAL 获取时间。//获取的是服务器时间,防止本机时间错误
ls_CurrentDate=string(today(),"yymmdd")//格式:14(年)01(月)03(日)
ls_CurrentTime=string(now(),‘hhmmss‘)//格式:23(时)59(分)59(秒)
说明:查找数据库中前6个字符为当前日期且后四位最大的值并将这后四位字符串赋值给maxNum。
//oralce
select max(subStr(id,7,10)) into :maxNum from t_bug
where substr(ID,1,6)=:ls_CurrentDate;
//sql server
select isnull(max(right(RowId,4)),‘0001‘) into :ls_maxID from
tb_stu_volunteer where left(rowID,6)=:ls_CurrentDate;
//注意:查询查询出来可能为null //select nvl() ……
ls_rowId=ls_CurrentDate + right(string(10000 + Integer(ls_maxID) +
li_i),4)
ls_lastWeekCurrentDay = string(relativedate(today(),-7),‘yyyy/mm/dd‘)
ls_CurrentDate=string(today(),"yymmdd")
//today()换成now()也可以
ls_CurrnetTime=string(today(),"hh:mm:ss")
//today()换成now()也可以
ls_CurrentDateTime=string(today(),"yyyy/mm/dd
hh:mm:ss") //today()换成now()也可以//简便
ldt_CurrentDateTime = DateTime(Today(),Now())
ls_CurrentDateTime=string(ldt_CurrentDateTime ,‘yymmddhhmmss‘)
假设当前日期时间为:"2014/01/16
12:25:46"
则ls_CurrentDateTime为"140116122546"
关于ID生成,布布扣,bubuko.com
关于ID生成
标签:style color c int strong 2014
原文地址:http://www.cnblogs.com/lishk/p/3720052.html