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

SQL Server函数大全

--聚合函数
use pubs
go
select avg(distinct price)  --算平均数
from titles
where type='business'
go 
use pubs
go
select max(ytd_sales)  --最大数
from titles
go 
use pubs
go
select min(ytd_sales) --最小数
from titles
go 
use pubs
go
select type,sum(price),sum(advance)  --求和
from titles
group by type
order by type
go 
use pubs
go 
select count(distinct city)  --求个数
from authors
go 
use pubs
go
select stdev(royalty) --返回给定表达式中所有值的统计标准偏差
from titles
go 
use pubs
go
select stdevp(royalty) --返回表达式中所有制的填充统计标准偏差
from titles
go 
use pubs
go
select var(royalty) --返回所有值的统计方差
from titles
go 
use pubs
go
select varp(royalty) --返回所有值的填充的统计方差
from titles
go 
--数学函数 
select sin(23.45),atan(1.234),rand(),PI(),sign(-2.34) --其中rand是获得一个随机数
--配置函数
SELECT @@VERSION --获取当前数据库版本
SELECT @@LANGUAGE --当前语言
--时间函数
select getdate() as 'wawa_getdate' --当前时间
select getutcdate() as 'wawa_getutcdate' --获取utc时间
select day(getdate()) as 'wawa_day' --取出天
select month(getdate()) as 'wawa_month' --取出月
select year(getdate()) as 'wawa_year' --取出年
select dateadd(d,3,getdate()) as wawa_dateadd --加三天,注意'd'表示天,'m'表示月,'yy'表示年,下面一样
select datediff(d,'2004-07-01','2004-07-15') as wawa_datediff --计算两个时间的差
select datename(d,'2004-07-15') as wawa_datename --取出时间的某一部分
select datepart(d,getdate()) as wawa_datepart &n


相关文档:

Sql Server基本函数

1.字符串函数
长度与分析用
datalength(Char_expr) 返回字符串包含字符数,但不包含后面的空格
substring(expression,start,length) 不多说了,取子串
right(char_expr,int_expr) 返回字符串右边int_expr个字符
字符操作类
upper(char_expr) 转为大写
lower(char_expr) 转为小写
space(int_expr) 生成int_expr个空格 ......

SQL面试题(转载)

SQL面试题(1)
create table testtable1
(
id int IDENTITY,
department varchar(12)
)
select * from testtable1
insert into testtable1 values('设计')
insert into testtable1 values('市场')
insert into testtable1 values('售后')
/*
结果
id department
1   设计
2   市场
3& ......

win7 下 配置 SQL Server 2005 允许远程访问

win7 下 配置 SQL Server 2005 允许远程访问
2010年2月2日 bibiQ
本来一直不愿意配置远程访问SQL server,但今天一狠心把它配好了。
参考了网上的帖子http://www.cnblogs.com/sukiwqy/archive/2009/11/11/1601381.html
step1: 配置SQL Server 外围应用配置器(为 SQL Server 2005 启用远程连接、启用 SQL Server Brow ......

SQL Server全文索引的个人总结(上) 关于中文分词


SQL Server全文索引的个人总结(上) -关于中文分词
(2005-11-14 04:29:44)
转载
 
分类:深度研究
大家都知道LIKE查询很慢,全文索引就是事先做好相关的索引,表示哪个主题词可以在哪些记录里找到,甚至事先计算好RANK,检索时可以把相关度高的先列出来,这可以大大提高检索的速度。
打个比方,你有 ......

最简单的最高效的过滤SQL脚本防注入

.errInfo
{
    border:solid 1px #d00;
    background:#F7F0F7;
}
1.URL地址防注入:
//过滤URL非法SQL字符
var sUrl=location.search.toLowerCase();
var sQuery=sUrl.substring(sUrl.indexOf("=")+1);
re=/select|update|delete|truncate|join|union|exec|insert|drop|count|&r ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号