Deploying SQL Math

Enabling CLR

SLQ Math can only be deployed on a Microsoft SQL Server that is configured to allow CLR.  CLR is the "Common Language Runtime", and used by all .Net applications.  This value is turned off by default as it isn't required to use SQL Server, however it has to be turned on in order to use any assemblies, such as SQL Math.

To determine if CLR is currently enabled execute the following statement:

Microsoft SQL Server CLR Enabled check

If the "run_value" column shows 0 then the CLR is not enabled on this server.  Execute the following statement (as an administrator)

Microsoft SQL Server 2008 R2

Installing SQL Math Assembly

From this point there are two methods to install the SQL Math library:

  1. Execute the "SQL Math Install.SQL" file.  This avoids needing to copy or access any file locations.  This is the default install method.
  2. Copy the SQL Math.DLL to a location the SQL Server can access then use "SQL Math Install - Alternative.SQL".  Find the section of the code that specifies the DLL location (see image below) and enter the SQL Math.DLL location.

Microsoft SQL Server Math

Either way this procedure will create or transfer the DLL into your database, and therefore you gain any advantages of backups, transferring and otherwise deploying your database.  However, it also means that you need to deploy SQL Math to each and every database in which you want to direct access features.

Modifying Names

All functions, constants and types are pre-named as shown in these help pages.  However, you are able to modify the name of SQL Math objects if they conflict with our own functions, or if you would simply prefer an alternative name.  For instance, the trigonometry section uses the full name of trigonometry functions, such as "InverseHyperbolicTangent" but these full names can be replaced with the abbreviated names such as "ArcTanH".

Search in the "Sql Math Install.SQL" for the required function and adjust it, as follows:

Default name:

Changing a user define function name

Custom name:

Microsoft SQL Server 2012 UDT

After executing this ArcTanH can be used instead of InverseHyperbolicTangent.

More than one function name can exist for the same assembly function.  This means that instead of replacing the first function above with the second you could include both.  This allows the full name format of InverseHyperbolicTangent and the short "ArcTanH" rather than replacing one with the other.

Purchase SQL Math