简体   繁体   中英

Deploying my first SQLCLR stored procedure to Amazon RDS SQL Server instance

At my current consulting assignments they are letting me use CLR Sprocs which is great (some past engagements did not for bogus reasons).

I followed all the steps at:

https://msdn.microsoft.com/en-us/library/5czye81z(v=vs.90).aspx

but made a simple Sproc in Visual Studio:

using System.Diagnostics;
public partial class StoredProcedures
{
    [SqlProcedure]
    public static void TestCLR_001 ()
    {
       Debug.Write("Hello World");
    }
}

and my admin ran:

sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'clr enabled', 1;
GO
RECONFIGURE;
GO

But when I build solution or deploy solution no errors but they never make it to SQL Server. Ie

use pls;

 Exec TestCLR_001;

does not work.

Msg 2812, Level 16, State 62, Line 3
Could not find stored procedure 'TestCLR_001'.

As far as configuring the RDS instance goes, have you tried setting clr enabled to 1 in the AWS DB Parameter Group? (approach taken from the following answer: SQL Server CLR stored procedures in AWS ).

Also, your method attribute might be wrong. I saw another issue just like this recently, and we got it fixed, but no definite confirmation on which combination of changes ultimately did the trick. But, I think the [SqlProcedure] is missing parenthesis and should be [SqlProcedure()] .

First try recompiling after adding in the parenthesis to the SqlProcedure attribute. If that doesn't work, try setting clr enabled to 1 in the AWS DB Parameter Group.

Also, a better / easier test would be to just have it do a PRINT statement by changing Debug.Write to be SqlContext.Pipe.Send .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM