Purpose:
We want that the users can execute the objects but can't view the code.
Solution:
CREATE Procedure .... WITH ENCRYPTION .....
Example:
CREATE Procedure [dbo].[GetStamTable]
As
Select * from dbo.StamTable
GO
CREATE Procedure [dbo].[GetStamTableWithEncrypt]
WITH ENCRYPTION
As
Select * from dbo.StamTable
GO
exec [GetStamTable]
exec [GetStamTableWithEncrypt]
-- same results
sp_helptext [GetStamTable]
-- we will get the SP code
sp_helptext [GetStamTableWithEncrypt]
--we will get an error message: The text for object 'GetStamTableWithEncrypt' is encrypted.
Notes:
1. Pay attention to save the code in order to alter it.....
2. This definition of encryption also affects the profiler, and can make it harder to work with it.
No comments:
Post a Comment