Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Creating a UserDefined CLR function in .Net
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Microsoft.SqlServer.Server;
- using System.Data.SqlTypes;
- using Microsoft.SqlServer.Types;
- namespace ClassLibrary1
- {
- public partial class Class1
- {
- [Microsoft.SqlServer.Server.SqlFunction]
- public static SqlString GetPassword(SqlString Value)
- {
- return Value;
- }
- }
- }
- CREATE ASSEMBLY ASSEM
- authorization dbo
- FROM 'E:NBM Sitestvt.stage.asentechdev1.comClassLibrary1.dll' WITH PERMISSION_SET = SAFE;
- CREATE FUNCTION SampleFunc
- (
- @value nvarchar(max)
- )
- RETURNS nvarchar(max) with execute as caller
- AS
- External Name ASSEM.Class1.GetPassword
- GO
- Could not find Type 'Class1' in assembly 'ClassLibrary1'.
- CREATE FUNCTION SampleFunc
- (
- @value nvarchar(max)
- )
- RETURNS nvarchar(max) with execute as caller
- AS
- External Name [ASSEM].[ClassLibrary1.Class1].[GetPassword]
- GO
Add Comment
Please, Sign In to add comment