java时间函数,以及 sql 时间范围查找 代码
String keyword = request.getParameter("keyword");
String timeRange = request.getParameter("timeRange");
String type = request.getParameter("type");
StringBuffer sql = new StringBuffer();
sql.append("use webstation_leadall select f.id,f.title,f.publishtime from information f left join infotype t on f.typeid=t.id where ");
if( (keyword == null)|| (keyword.equals("")) ){
sql.append("title like '%' and ");
}else {
sql.append("title like '%"+keyword +"%' and ");
}
if(timeRange.equals("")||timeRange==null){
sql.append("");
}else{
//Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd kk:mm:ss");
//String now = sdf.format(cal.getTime());
String begintime = "";
String endtime = "";
java.util.Date myDate=new java.util.Date();
long myTime = 0;
if(timeRange.equals("1")){
myTime=((myDate.getTime()/1000)-60*60*24)*1000;
begintime = sdf.format(new java.util.Date(myTime));
endtime = sdf.format(myDate);
//System.out.println("------"+begintime+"+++++"+endtime);
}else if(timeRange.equals("3")){
myTime=((myDate.getTime()/1000)-60*60*24*3)*1000;
begintime = sdf.format(new java.util.Date(myTime));
endtime = sdf.format(myDate);
//System.out.println("------"+begintime+"+++++"+endtime);
}else if(timeRange.equals("7")){
myTime=((myDate.getTime()/1000)-60*60*24*7)*1000;
&n
相关文档:
优点:字段较少,有增删改查功能,不过查询太笼统。
缺点:
1.不算是在很正的无限分类,ClassPath这个字段定义限制。
2.主键CLASSID不是自增的,使用CODESMITH批量生成多层架构代码中会导致出错。
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ArticleClass]') and OBJECTPROPERTY(id, N'IsUse ......
首先用查询语句,从tblTask表中查询出所有的数据,然后将其保存为csv格式。
在SQL语句窗口,输入如下内容:
USE Keii BULK INSERT dbo.tblTask
& ......
在分组排序过程中需要新建排序列,按条件:(物料分类+客户名称) 进行分组汇总 然后就根据该条件进行排序
1.需要拼凑两列 作为排序列,如需加入特殊字符.就会报错.
因为本身改字段就是varchar类型 需要将char类型'_' 转换成varchar
2.拼凑过程中有空格需要去空格
e.g:select (trim(物料分类)+to_char( ......
BEGIN TRANSACTION--开始事务
DECLARE @errorSun INT --定义错误计数器
SET @errorSun=0 --没错为0
UPDATE a SET id=232 WHERE a=1 --事务操作SQL语句
SET @errorSun=@errorSun+@@ERROR --累计是否有错
UPDATE aa SET id=2 WHERE a=1 --事务操作SQL语句
SET @errorSun=@errorSun+@@ERROR --累计是否有错
I ......