易截截图软件、单文件、免安装、纯绿色、仅160KB

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


相关文档:

SQL无限分类存储过程整理1

优点:字段较少,有增删改查功能,不过查询太笼统。
缺点:
1.不算是在很正的无限分类,ClassPath这个字段定义限制。
2.主键CLASSID不是自增的,使用CODESMITH批量生成多层架构代码中会导致出错。
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ArticleClass]') and OBJECTPROPERTY(id, N'IsUse ......

CSV文件导入到SQL Server 2005数据库中

首先用查询语句,从tblTask表中查询出所有的数据,然后将其保存为csv格式。
在SQL语句窗口,输入如下内容:
USE Keii BULK INSERT      dbo.tblTask
                      & ......

动态sql语句基本语法

1 :普通SQL语句可以用Exec执行
      例:      Select * from tableName
                Exec('select * from tableName')
        & ......

sql查询表结构,过程,视图,主键,外键,约束

 一、表结构查询
SELECT TOP (100) PERCENT a.name AS zdm,COLUMNPROPERTY(a.id, a.name, 'IsIdentity') AS bs ,
CASE WHEN EXISTS (SELECT 1 from dbo.sysindexes si INNER JOIN dbo.sysindexkeys sik ON si.id = sik.id
 AND si.indid = sik.indid INNER JOIN dbo.syscolumns sc ON sc.id = sik.id AND sc. ......

sql查找某个字符串第N次出现的位置的函数(转帖)

if exists(select 1 from sysobjects where name='char_index')
drop function char_index
create function char_index(@string varchar(8000),@char varchar(10),@index smallint)
--@string:待查找字符串,@index:查找位置
returns smallint
as
begin
  declare
  @i tinyint,--当前找到第@i个
  ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号