2. Create a new file into it.
3. Add the below code into it ...
Just build it and deploy this code. Building and deploying is as simple as just right clicking on the project name and choosing the appropriate option.
public partial class StoredProcedures
public static void SimpleSP()
objPipe = SqlContext.GetPipe();
//current month no
//no of days
Open SQL Server Management Studio
1. Create a new query
2. Try and execute the SP written via VS.NET
It would most probabaly throw an error like this:
Msg 6263, Level 16, State 1, Line 1
Execution of user code in the .NET Framework is disabled. Use sp_configure 'clr enabled' to enable execution of user code in the .NET Framework.
By default execution of the code in .NET framework is disable ... so just run the below two lines to enable it.
sp_configure 'clr enabled', 1Now try to execute the SP it would work fine and display the numeric value of the current month. Also it would display the number of days in the month of "July".
RECONFIGURE WITH OVERRIDE