码迷,mamicode.com
首页 > 数据库 > 详细

在SQL中把一个浮点数的整数部分和小数部分分开

时间:2014-09-29 19:44:01      阅读:452      评论:0      收藏:0      [点我收藏+]

标签:convert   actual   

select item_no, actual_hours,

(actual_hours/8) as days,

--charindex(‘.‘,cast((actual_hours/8) as varchar))-1 as dianindex,

--cast(left(cast((actual_hours/8) as varchar) , charindex(‘.‘,cast((actual_hours/8) as varchar)) - 1) as int)as zhengshu,

--convert(decimal(18,4),(‘0.‘+reverse(cast(cast(reverse(substring(cast((actual_hours/8) as varchar) , charindex(‘.‘,cast((actual_hours/8) as varchar)) + 1 , len(cast((actual_hours/8) as varchar)))) as int) as varchar))))*8 as hours ,

 --cast(left(cast((actual_hours/8) as varchar) , charindex(‘.‘,cast((actual_hours/8) as varchar)) - 1) as int) as days,

start_date,actual_begin_date

--into #ta 

from work_item 

where actual_complete_date is not null and actual_hours=8 --and charindex(‘.‘,cast((actual_hours/8) as varchar))-1<=-1


在SQL中把一个浮点数的整数部分和小数部分分开

标签:convert   actual   

原文地址:http://jyb2014.blog.51cto.com/9155315/1559489

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!