Table valued function only returns CLR error

Posted by Anthony on Stack Overflow See other posts from Stack Overflow or by Anthony
Published on 2010-04-27T03:23:18Z Indexed on 2010/04/27 3:23 UTC
Read the original article Hit count: 362

I have read-only access to a database that was set up for a third-party, closed-source app. Once group of (hopefully) useful table functions only returns the error:

Failed to initialize the Common Language Runtime (CLR) v2.0.50727 with HRESULT 0x80131522. You need to restart SQL server to use CLR integration features. (severity 16)

But in theory, the third-party app should be able to use the function (either directly or indirectly), so I'm convinced I'm not setting things up right.

I'm very new to SQL Server, so I could be missing something obvious. Or I could be missing something really slight, I have no idea.

Here is an example of a query that returns the above error:

SELECT * FROM 
dbo.UncompressDataDateRange(4,'Apr 24 2010 12:00AM','Apr 30 2010 12:00AM')

Where the function takes three parameters:

  1. The Data Set (int) -- basically the data has 6 classifications, and the giant table this should be pulling from has a column to indicate which is which.

  2. startDate (smalldatetime)

  3. endDate (smalldatetime)

There are other, similar functions that expand on the same idea, all returning the same error.

Quick Note:

I'm not sure if this is relevant, but I was able to connect to the database via SQL Studio (but without the privs to script the functions as code), and a checked the dependency for the above sample function. It turns out that it is a dependent of a view that I have gotten to work, and that view is dependent of the larger, much-hairier data-table.

This makes me think I should somehow be pointing the function at the results of the view, but I'm not seeing any documentation that shows how that is done.

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about sql-server-2005