SQL Server 2008 R2 allows encryption of functions and stored procedures. Adding the WITH ENCRYPTION option when creating a function or stored procedure will encrypt it, preventing viewing of the source code or generation of a script. Examples show encrypting a function that calculates the sum of two numbers and a stored procedure that calculates a sum and outputs the result. Both encrypted objects cannot be modified or have their scripts viewed afterwards.
Axa Assurance Maroc - Insurer Innovation Award 2024
How to encrypt your script on sql server
1. How to encrypt your function or stored procedure on Microsoft SQL Server 2008 R2 By: IkhwanKrisnadi Software Engineer Y!: ikhwankrisnadi Gtalk: krisnadiikhwan
2. Introduction SQL Server 2008 R2 gives facility to encrypt your script of function or stored procedure If you encrypt it, your function or stored procedure can not be viewed its source code Also, you can not generate script of your function or stored procedure that you encrypted
3. How to encrypt? Add option WITH ENCRYPTION on your script of function or stored procedure Encryption on function
5. Example: Encrypt on Function Create function with named fnAdd2Numbers . This function to calculate sum of 2 numbers
6. Example: Encrypt on Function (Continued) Right click on your function at Microsoft SQL Server Management Studio 2008 R2 . Then click “Modify” or “Script Function as”
7. Example: Encrypt on Function (Continued) It will displayed below message to indicate that you can not modify or view its script
8. Example: Encrypt on Stored Procedure Create function with named spAdd2Numbers . This stored procedure to calculate sum of 2 numbers then output the result
9. Example: Encrypt on Stored Procedure (Continued) Right click on your stored procedure at Microsoft SQL Server Management Studio 2008 R2 . Then click “Modify” or “Script Function as”. You can not click “Modify” because it is disabled. Click “Script Function as”
10. Example: Encrypt on Stored Procedure (Continued) It will displayed below message to indicate that you can not modify or view its script