We can create a view with encryption so that its script cannot be deciphered.
CREATE VIEW vwEmpSalary
WITH ENCRYPTION
AS
SELECT Id, first_name, last_name, salary
FROM Employees
Now run the following stored procedure to see the text of view.
sp_helptext 'vwEmpSalary'
We get the following message
The text for object 'vwEmpSalary' is encrypted.
Alternatively, we can use the following query to get the script of a view if it is not encrypted.
SELECT id, ctext, text
FROM SYSCOMMENTS
WHERE ID = OBJECT_ID('vwEmpSalary')
Since the view is encrypted, we get null values.
No comments:
Post a Comment