Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 946
  • Last Modified:

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.
0
venanciop
Asked:
venanciop
1 Solution
 
venanciopAuthor Commented:
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,
0
 
tbsgadiCommented:
Have a look at http:Q_23952396.html 

Gary
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now