Sql2005 Managed Stored Proc Error
Ok – so I created a new class library project – I referenced sqlaccess.dll
I added my new class which looks like this :
namespace testsqlclr.SProcTest1
{
public class GetIssueSummaryTable
{
[SqlProcedure]
public static void GetIssues()
{
SqlPipe pipe = SqlContext.GetPipe();
SqlCommand cmd = SqlContext.GetCommand();
cmd.CommandText = "Select issueid,issuetitle from issue";
SqlDataReader reader = cmd.ExecuteReader();
pipe.Send(reader);
}
}
}
From SQL Studio in SQL 2005 I try this:
create assembly dytest1 from 'c:\testapp\testsqlclr\testsqlclr\bin\debug\testsqlclr.dll'
The result is :
Msg 6212, Level 16, State 1, Line 1
CREATE ASSEMBLY failed because method 'get_Value' on type 'testsqlclr.Properties.Settings' in safe assembly 'testsqlclr' is storing to a static field. Storing to a static field is not allowed in safe assemblies.
Anyone else run into this and find a work around?
I was so excited to actually see it work!