Friday, 14 November 2014

Encrypting Views



      Using 'SP_HELPTEXT' (SP_HELPTEXT <View name>)we can see the view code. If we create a view with "WITH ENCRYPTION" then we can't see the view code.




Example:

View Creation Script:


CREATE VIEW EMPLOYEE4
WITH ENCRYPTION
AS
SELECT A.ID
      ,A.FirstName
      ,A.LastName
      ,A.Gender
      ,A.Dept_ID
      ,B.Name
      ,B.Location
FROM EMPLOYEE A
JOIN DEPT B 
ON A.Dept_ID = B.DeptID


Checking view source code: 
     If we try to view the view code it will through the message.



SP_HELPTEXT EMPLOYEE4




No comments:

Post a Comment