Link to home
Start Free TrialLog in
Avatar of venanciop
venanciop

asked on

SQL SERVER IRR function

I saw one in website, but it does not accept numbers with decimal cases, so is not 100% accurated.
I'd like to know if anyone has a IRR funtion.
Avatar of venanciop
venanciop

ASKER

Actually the issue is not related to the function. But to a conversion.

declare @aux varchar(8000), @inicio datetime

set @inicio= getdate()-1

SET @AUX = (select convert( varchar(100),(cast(round(fc,2) as decimal(38,2))))+',' FROM t1 where dt_posicao = @inicio)

ERROR:
Conversion failed when converting the varchar value '-859396252.29,' to data type int.

It's crazy, because if I run the query as itself:
select convert( varchar(100),(cast(round(fc,2) as decimal(38,2))))+',' FROM t1 where dt_posicao = @inicio

It works:
-5454141.56,
16195539.63,
-775863.01,
25267295.91,
16633219.77,
1464111.18,
-12863222.99,
2963694.59,
-50465124.40,
-3044618.40,
10905439.85,
16471310.55,
5958809.99,
16423319723.80,
-859396252.29,
ASKER CERTIFIED SOLUTION
Avatar of tbsgadi
tbsgadi
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial