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

sql获取日期

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


相关文档:

SQL Server中临时表与表变量的区别

我们在数据库中使用表的时候,经常会遇到两种使用表的方法,分别就是使用临时表及表变量。在实际使用的时候,我们如何灵活的在存储过程中运用它们,虽然它们实现的功能基本上是一样的,可如何在一个存储过程中有时候去使用临时表而不使用表变量,有时候去使用表变量而不使用临时表呢?
  临时表
  临时表与永久表相似, ......

防止SQL注入

原文地址: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语句,从而成功获取想要的数据。
......

ASP.NET SQL 注入解决方案

任何一种使用数据库web程序(当然,也包括桌面程序)都有被SQL注入的风险。防止被SQL注入,最基本的方法是在代码级别就要阻止这种可能,这个网上讲的很多,我就不多说了。不过如果你拿到的是一个已经完工的产品,这个时候该如何解决呢?我介绍几种对于ASP和ASP.NET有效的防止SQL注入的方案,而且是免费的。
UrlScan 3.1
......

240个国外SQL Server高手的博客集萃

Aaron Bertrand
Adam Machanic
All Things SQL Server
Allen Kinsel - SQL DBA
Allen White
Amit Bansal writes...
Andrew Fryer's Blog
Andrew Kelly
Andy Leonard
Anything and Everything IT
Arcane Code
Arnie Rowland: Ramblings of a Harried Technogeek
B.I. for the SQL Guy
Bart Duncan's SQL Weblog ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号