Friday, July 5, 2013

How to encrypt a procedure in sql server


Example Code for Stored Procedure Encryption - SQL SERVER

/*STEP1: create stored procedure*/
create procedure SSP_SelectNo
with encryption
as begin
select 1 as no
end
go
/*STEP2: Execute stored procedure*/
exec SSP_SelectNo
go
/*STEP3: Get Contents of stored procedure*/
sp_helptext 'SSP_SelectNo'

Code Explanation:

The keyword used to encrypt the stored procedure in sql server  is "with encryption". When you create a stored procedure with this keyword the stored procedure source code cannot be seen anymore.So please save a copy of your stored procedure before encrypting it. This will be useful when the sql server is installed at the client end and can avoid source code theft to some extent.

Stored Procedure Encryption in Sql Server Image

sql server procedure encryption image

No comments:

Post a Comment