SQL Server – CLR

CLR in Sql Server

Links:

http://www.codeproject.com/Articles/680161/Getting-Started-With-SQL-Server-CLR-User-Defi

 

To install an assembly – from dll file:

-- Install Assembly
CREATE ASSEMBLY UDF_Blog FROM 'C:\UDF_Blog.dll'
GO

Note to self: we did not use this so far. It look like this instead:

CREATE ASSEMBLY [LDVOvervaagning]
AUTHORIZATION [dbo]
FROM 0x4D5A90000300000004000000FFFF0000B80000000...-> looong
WITH PERMISSION_SET = EXTERNAL_ACCESS;

 

Also – how to handle an C# entity – if possible at all?

  • via xml – as a string
  • via out parameters

 

Load af Assembly info sql server 2012

Can be done like this – notice namespace and class name is like:

[LDVDataLeveringClientWebClr.DataLeveringClient]
Declare @NSql Nvarchar(4000)

    Set @NSql = 'CREATE PROCEDURE [dbo].[System_KlargoerDataCLR]
        @SystemId [nvarchar](4000),
        @DatabaseVersion [nvarchar](4000),

        @FejlTekst  [nvarchar](4000) output
    WITH EXECUTE AS CALLER
    AS
    EXTERNAL NAME SQLCLRTestWebRef.[LDVDataLeveringClientWebClr.DataLeveringClient].KlargoerData'

    Exec(@NSql)

 

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s