declare
@aa varchar(20)
set @aa= CONVERT(varchar(100), GETDATE(), 23)
--//日
print @aa+' 0:00:00.000'
print @aa+' 23:59:59.999'
--//周
print CONVERT(varchar(100), DATEADD(wk, DATEDIFF(wk,0,getdate()), 0), 23)+' 0:00:00.000'
print CONVERT(varchar(100), DATEADD(wk, DATEDIFF(wk,0,getdate()), 6), 23)+' 23:59:59.999'
--//月
print CONVERT(varchar(100), DATEADD(m, DATEDIFF(m,0,getdate()), 0), 23)+' 0:00:00.000'
print CONVERT(varchar(100), DATEADD(m, DATEDIFF(m,0,getdate()), 30), 23)+' 23:59:59.999'
select distinct (userid),sum(score) as SumScore from ph where endTime between @aa+' 0:00:00.000' and @aa+' 23:59:59.999' group by userid order by SumScore desc
select distinct (userid),sum(score) as SumScore from ph where endTime between CONVERT(varchar(100), DATEADD(wk, DATEDIFF(wk,0,getdate()), 0), 23)+' 0:00:00.000' and CONVERT(varchar(100), DATEADD(wk, DATEDIFF(wk,0,getdate()), 6), 23)+' 23:59:59.999' group by userid order by SumScore desc
select distinct (userid),sum(score) as SumScore from ph where endTime between CONVERT(varchar(100), DATEADD(wk, DATEDIFF(wk,0,getdate()), 0), 23)+' 0:00:00.000' and CONVERT(varchar(100), DATEADD(wk, DATEDIFF(wk,0,getdate()), 6), 23)+' 23:59:59.999' group by userid order by SumScore desc
我们在数据库中使用表的时候,经常会遇到两种使用表的方法,分别就是使用临时表及表变量。在实际使用的时候,我们如何灵活的在存储过程中运用它们,虽然它们实现的功能基本上是一样的,可如何在一个存储过程中有时候去使用临时表而不使用表变量,有时候去使用表变量而不使用临时表呢?
临时表
临时表与永久表相似, ......
原文地址:http://hi.baidu.com/%BC%D9%BA%EC%D2%B6%CE%E8%CE%F7%B7%E7/blog/item/81f35da209e287abcbefd005.html
1. 什么是SQL注入
所谓SQL注入,就是通过把SQL命令插入到Web表单递交或输入域名或页面请求的查询字符串,最终达到欺骗服务器执行恶意的SQL命令。通过递交参数构造巧妙的SQL语句,从而成功获取想要的数据。
......
任何一种使用数据库web程序(当然,也包括桌面程序)都有被SQL注入的风险。防止被SQL注入,最基本的方法是在代码级别就要阻止这种可能,这个网上讲的很多,我就不多说了。不过如果你拿到的是一个已经完工的产品,这个时候该如何解决呢?我介绍几种对于ASP和ASP.NET有效的防止SQL注入的方案,而且是免费的。
UrlScan 3.1
......