1、sql函数:
reverse(2014)//反转,4102
len(2014) //长度,4
left(12324,2) //从左边截取,12
right(12324,2) //从右边截取,24
round(3.75,1) //四舍五入,3.80
floor(3.75) //向下取整,3
ceiling(3.75) //向上取整,4
sign(-3.75) //符号,-1.00
abs(-3.75) //绝对值,3.75
getdate() //当前时间(含毫秒),2014-07-24 10:48:25.733
2、将时间格式(2014-07-21 15:15:15)转化为(2014-07-21 15:15),去掉秒。
select left(col002,len( col002)-charindex(':',reverse(col002))) as startTime from table
3、删除table表中name重复的记录
delete from table where id not in ( select min(id) from table group by name)