Articles → SQL SERVER → Stored Procedure Encryption In SQL Server

Stored Procedure Encryption In SQL Server






Software Requirement





Prerequisite Knowledge





What Does Encryption Mean?





Syntax




CREATE PROC [PROC_NAME]
    [LIST OF INPUT VARIABLES]
WITH ENCRYPTION
AS
[PROC_BODY]



Example




CREATE PROC sp_GetDBName @db_name varchar(100) WITH ENCRYPTION AS 
SELECT 
  * 
FROM 
  SYS.databases 
Where 
  name = @db_name




Picture showing the message that shows that the stored procedure is encrypted




Picture showing the error message when user tries to generate the script of the encrypted stored procedure



Disadvantage Of Encrypting A Stored Procedure




  1. Stored procedure definitions should be stored in a separate file, as encrypted procedures cannot be retrieved from SQL Server Management Studio. If this file is lost, the definition is irrecoverable.
  2. Encryption requires an extended handshake and lots of CPU cycles. For high-volume sites, you need a high-performance CPU



Posted By  -  Karan Gupta
 
Posted On  -  Saturday, February 2, 2013

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250