ninjadeathmonkey
Programmer
I'm creating a function that calls a class I wrote in C# to encrypt and decrypt text.
I can get this code to create the function just fine:
The problem is when I wrap an IF/ELSE around the "EXTERNAL NAME..." it won't let me create it. What I would like to do is something like this:
Any suggestions?
Ron Wheeler
Tekdev Open Source Development
I can get this code to create the function just fine:
Code:
CREATE FUNCTION DECRYPT_RSA
(
@Expression NVARCHAR(max),
@PrivateKey NVARCHAR(max)
)
RETURNS NVARCHAR(max)
AS
EXTERNAL NAME MANAGEDFUNCTIONS.[MyAssembly.SqlMethods.Cryptography].RSADecrypt
GO
The problem is when I wrap an IF/ELSE around the "EXTERNAL NAME..." it won't let me create it. What I would like to do is something like this:
Code:
CREATE FUNCTION DECRYPT_RSA
(
@Expression NVARCHAR(max),
@PrivateKey NVARCHAR(max)
)
RETURNS NVARCHAR(max)
AS
IF @Expression IS NOT NULL
BEGIN
EXTERNAL NAME MANAGEDFUNCTIONS.[MyAssembly.SqlMethods.Cryptography].RSADecrypt
END
GO
Any suggestions?
Ron Wheeler
Tekdev Open Source Development