Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Financial Functions in SQL

Author  Topic 

Lewie
Starting Member

42 Posts

Posted - 2003-12-31 : 04:55:28
I am trying to do bulk calcualtions in SQL that uses the Rate Function that you find in VB or Excel. SQL does not have this function and I am trying to find a fast way of doing it. Currently I have created a dll function with the VB rate function in it which I call from my SQL SP but this is a very slow method when trying to update +150000 records. I want to use straight SQL without having to go via analysis server that could do it for me.

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2004-01-02 : 05:50:33
If your version of SQL is 2K, then a UDF may be a better solution.
Go to Top of Page

Lewie
Starting Member

42 Posts

Posted - 2004-01-02 : 08:10:34
The Rate function is complicated and cannot be done with a UDF.
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2004-01-02 : 08:17:47
That makes no sense, it was done as a function in VB. And if you feel it can't be done in a UDF, why ask whether it can be done?

Take a look here:

http://www.intelligententerprise.com/online_only/celko/030303_2.shtml

Joe has some solutions for the IRR function, which can be modified to provide Rate.
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2004-01-02 : 11:15:32
I agree with ROB...the complexity alone of the solution doesn't mean a UDF cannot be done.
It would have to be something inherant in the calculation process that stops the UDF being created....
Go to Top of Page

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2004-01-02 : 16:23:22
We've seen IRR before

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=23307
Go to Top of Page

Lewie
Starting Member

42 Posts

Posted - 2004-01-08 : 07:21:28
VB has a built in function for the RATE and you don't need to do any calculations. I'm sure it can be done mathematically in UDF, just not easily.

Thanks for the url's. They will come in handy.
Go to Top of Page

minarik
Starting Member

1 Post

Posted - 2008-11-18 : 17:16:44
I realize this post is pretty old, but we did replicate (pretty closely anyway) the RATE function in T-SQL. Check out the blog:

http://charlottecredittechnology.blogspot.com/

Go to Top of Page
   

- Advertisement -