Skip to content

A SQL CLR project that enables IRR (Internal Rate of Return) calculations to be done in SQL Server, helping you to replace those pesky Excel Spreadsheets

Notifications You must be signed in to change notification settings

nigelainscoe/SqlIRR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SqlIRR

I assume that if you have got here you are looking for a way to calculate IRR from a T-SQL script or stored procedure. I also assume you are familiar with SQL Server Database Projects.

Setup and deployment

The project is a Visual Studio 2017 database project and is configured to deploy just the CLR and to create a function (dbo.SqlIRR). Before you deploy you will need to do the following:

Sign the assembly in the project's Properties\SQLCLR\Signing dialog.

Enable CLR functions for your SQL Server (if not already enabled) to do this issue the following commands (needs sysadmin permissions)

sp_configure 'show advanced options', 1;  
GO  
RECONFIGURE;  
GO  
sp_configure 'clr enabled', 1;  
GO  
RECONFIGURE;  
GO 

Usage

    DECLARE @Revenues AS NVARCHAR(MAX) = '-3000, 1850, 1400, 1000'
    SELECT dbo.SqlIRR(@Revenues)

This project is heavily based on the work of Joseph A. Nyirenda and Mai Kalange. You can find more information about this at http://zainco.blogspot.com/2008/08/internal-rate-of-return-using-newton.html

About

A SQL CLR project that enables IRR (Internal Rate of Return) calculations to be done in SQL Server, helping you to replace those pesky Excel Spreadsheets

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages