sql server 2008 r2 - Multiply value, round down and CAST Select in SQL -



sql server 2008 r2 - Multiply value, round down and CAST Select in SQL -

i have sql function gathers labour times multiple records, , uses stuff(cast varchar(20)) concatenate them single column in temp table.

my issue labour values in table in hours , rounded downwards 7 decimals, want convert values minutes , round them downwards 2 decimals before stuffing them temp table.

update: forgot mention, i'm using sql server 2008 r2

here code.

@site nvarchar(20) ,@item nvarchar(30) ,@enviro nvarchar(30)) returns nvarchar(max) begin declare @lbrhours nvarchar(max) = '' if @enviro = 'test' begin if @site = 'arborg' begin set @lbrhours = stuff((select ',' + cast(jrt.run_lbr_hrs varchar(20)) arborg_test_app.dbo.jobroute jbr inner bring together arborg_test_app.dbo.job job on job.job = jbr.job , job.suffix = jbr.suffix inner bring together arborg_test_app.dbo.item itm on itm.job = job.job inner bring together arborg_test_app.dbo.jrt_sch jsh on jbr.job = jsh.job , jbr.suffix = jsh.suffix , jbr.oper_num = jsh.oper_num left outer bring together arborg_test_app.dbo.jrt_sch jrt on jbr.job = jrt.job , jbr.suffix = jrt.suffix , jbr.oper_num = jrt.oper_num job.suffix = '0' , job.type = 's' , itm.item not null , itm.item = @item , jbr.suffix = case -- homecoming standard cost if standard operation exist, else homecoming current cost when itm.cost_type = 's' '1' -- '1' standard operation else '0' -- '0' current operations end order itm.item, jbr.oper_num xml path('')), 1, 1, '') end end homecoming @lbrhours end

jrt.run_lbr_hrs column contains labour times in hours in our erp's table. how can multiply 60 , round downwards 2 decimals in existing stuff(case nvarchar)?

cast decimal 2 value after point , varchar

cast(cast(jrt.run_lbr_hrs * 60 decimal(10, 2)) varchar(20))

change decimal dimension need

sql sql-server-2008-r2

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -