More information on managed code UDF's in SQL Server 2005

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • CDMAPoster@FortuneJames.com

    #1

    More information on managed code UDF's in SQL Server 2005

    In:



    I said:
    >Here's the reply:
    >
    >'-------
    >You can find information on CREATE ASSEMBLY here.
    >
    >
    >http://msdn2.microsoft.com/en-us/library/ms189524.aspx
    >
    >
    >Mike
    >'-------
    Here's some more information on managed code UDF's in SQL Server 2005:
    >From CLR Integration example, DAT418 (Christian Kleinerman):
    Public Function
    GetTax(ByVal amount As Integer) As Integer
    Return (amount * 0.68)
    End Function

    Compile code into an assembly.

    SQL Server 2005:

    CREATE ASSEMBLY FinancialLib
    FROM 'c:\FinLib\bin\ bl.dll'
    WITH PERMISSION_SET = EXTERNAL_ACCESS

    After that step, the assembly is copied into SQL Server.

    CREATE FUNCTION financial.GetTa x(@it int)
    RETURNS decimal(38,10)
    AS EXTERNAL

    SELECT financial.GetTa x(id)
    FROM hr.employees;

    James A. Fortune
    CDMAPoster@Fort uneJames.com

Working...