zoukankan      html  css  js  c++  java
  • 关于ID生成

    关于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"
  • 相关阅读:
    复习清单
    pat 1132 Cut Integer(20 分)
    pat 1013 Battle Over Cities(25 分) (并查集)
    pat 1100 Mars Numbers(20 分)
    pat 1108 Finding Average(20 分)
    OpenCV入门学习资料汇总
    SIFT算法问题issue1
    《机器学习》瓜书—周志华
    Pycharm配置
    在cmd下可以import cv2,而Pycharm报错:找不到cv2
  • 原文地址:https://www.cnblogs.com/lishk/p/3720052.html
Copyright © 2011-2022 走看看