Sql server: Encrypt store procedure, view and function - Free Asp.Net,MVC,AngularJs,Jquery,Javascript,Sql Server,WCF,Entity framework snippets and tutorial


Sql server: Encrypt store procedure, view and function

In this article I am going to explain how to Encrypt store procedure, view and function in sql server.


Description:
We write most of logic in Store procedures. Sometime due to security reason we have to hide the logic from end users. Keyword With encryption is used to encrypt the text/logic of store procedure, view and function.

Encrypt store procedure
Syntax
create proc sp with encryption
as begin
Select * from tablename
end

Example:
create proc Spuser with encryption
as begin 
Select * from dbo.tbuser 
end

Encrypt view
create view fnuser with encryption
as
Select * from tbuser

Encrypt function
CREATE FUNCTION udfnuse (@userID int)  
RETURNS int   with encryption
AS
BEGIN 
   return @userid
END; 
GO 

Note: if store procedure, view and function are encrypted it is not possible to get definition. We can get the definition of encrypted store procedures, view and function using the third party tools (Optillect SQL Decryptor). 



What do you think about this article?

If you found this article useful, please share and follow on Facebook, Twitter, Google Plus and other social media websites. To get free updates subscribe to newsletter. Please put your thoughts and feedback in comments section.

Share this

Share on FacebookTweet on TwitterPlus on Google+
loading...


EmoticonEmoticon