All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
项目调试时出现用到的一个组件“访问被拒绝”的解决方法_[Asp.Net教程]
SQL循序渐进(16)数学运算符_[SQL,Server教程]
C#返回汉字的首字母_[Asp.Net教程]
PHP实例:PHP如何实现在线发邮件_[PHP教程]
VS.Net,C#,调用,Active,组件_[Asp.Net教程]
利用PHP和AJAX创建RSS聚合器_php资料_编程技术
Delphi带进度条的状态栏
规范设计数据库应注意的14个技巧_[SQL Server教程]
C#提交数据到服务器并返回的处理_.net资料_编程技术
iframe的高度随内容的变化而变化_[Html教程]
Reading number is top 10 pictures
这才是真正的人体艺术1
迷人的靓女
2013中国四川省高考作文
Small QiShu -- ShuangShuangPan2
Sanya, hainan Haitian party feast promiscuity
A resort photographed beautiful young woman change clothes process vomiting blood1
2012 national geographic daily picture3
Green sweet joey wong young old photos exposure
世界各国15岁的MM有什么不同
Ashlynn Brooke show proud chest measurement1
Download software ranking
卡丁车单机版
终极变速大师Speeder3.26
电脑知识及技巧大合集
XML+Web+Service开发教程
Unix video tutorial15
Boxer vs Yellow3
VC++6.0简体中文版
小黑猫大战两米大花蛇
1400篇各类破解文章
Tram sex maniac 2 (H) rar bag1
归海一刀 published in(发表于) 2014/2/3 6:39:09 Edit(编辑)
Sqlserver常用函数例子说明_[SQL Server教程]

Sqlserver常用函数例子说明_[SQL Server教程]

Sqlserver常用函数例子说明_[SQL Server教程]

在操作SQLServer的时候, 很多时候记不住具体的函数如何使用, 查找联机帮助还是嫌麻烦, 且有很多时候例子也不好懂, 下面对每个常用的函数用用例子说明,一目了然,你自己在数据库中执行一下,结果就知道什么回事了


--字符串功能
--substring
print substring('iamagoodperson',1,5)
select substring('iamagoodperson',1,5)


--upper
select upper('he is a good person')


--lower
select LOWER('this is an VERY interesting job')


--ltrim
select ltrim(' i am a good person')


--rtrim
select rtrim(' heihei,i do not know why it likes this ')



--replace
select replace('iwanttoaskyou','ttoa','i love you')


--stuff
select stuff('我的名字是朱旭杰',6,8,'summer')


--Date/Time Fuction
--getdate()
select getdate() as 'today'


--dateadd()
select dateadd(yy,10,getdate())


--datediff()
select datediff(yy,'1982/5/3',getdate()) as


--datepart()
select datepart(dw,getdate())
select datepart(yy,getdate())
select datepart(mm,getdate())
select datepart(dd,getdate())
select datepart(ss,getdate())
select datepart(ms,getdate())
select datepart(dd,'1982/5/3')
print datepart(dw,'1982/8/22')


--day(),相当于datepart(dd,时间)
select day('1982/5/3')
select day(getdate())

--month(),相当于datepart(mm,时间)
select month(getdate())


--year(),相当于datepart(yy,时间)
select year(getdate())


--数学函数


--abs()
select abs(-100.3456)


--sin()
select sin(0.54)


--cos()
select cos(3.14)


--power()
select power(10,2)


--round 返回数字表达式并四舍五入为指定的长度或精度



select round(100.45,1)
select round(123,45,-2)


--floor()
select floor(4.9)
select floor(-123.99)


--ceiling()
select ceiling(4.9)
select ceiling(-123.99)


--sqrt()
select sqrt(100)


--square
select square(10)
select square(-15)


--转换函数
--cast()
select cast(100.45 as int)
select cast(1345 as varchar(10))


--convert()
select convert(int,100.56)
select convert(varchar(10),2345)


--空值函数
--isnull()
declare @temp_table table
(
bookID VARCHAR(10) primary key,
book_price float default null,
bookName varchar(50)
)
insert into @temp_table values('1',50,'c#')
insert into @temp_table values('2',null ,'c')
select bookID AS '书的编号',isnull(book_price,0) as '书的价格'
from @temp_table


--nullif(),只要参数里的两个表达式相同就返回null
select nullif('iam','iam')


--coalesce返回其参数中第一个非空表达式
select coalesce(null,null,'i am a good boy')








添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.