Introduction
Today we are going to learn how to encrypt the logic of a view from the end user or others. There are several reasons to hide the logic of a view. The most important reason is security. We encrypt the view using the "with encryption" keyword.
I assume you have a basic understanding of views. For more help visit, View in SQL Server. In my previous article I described how to encrypt a Stored Procedure; for that you can visit Encryption of Stored Procedure in SQL Server.
First of all we create a table named student. After that we create a view named view1 without encryption. Then we show the logic of that view with the help of a command. After that we create another encrypted view named view2. And show that we can't see the logic of the encrypted view.
Creation of table:
create table emp(empId int, empName varchar(15), empAdd varchar(15))
Insertion of data:
insert into emp
select 1,'d','canada'union all
select 2,'e','la'union all
select 3,'f','usa'
Output:

Creation of unencrypted View:
create view view1
as





Deepak MiddhaPosted Nov 27, 2012, 5:12 AM
Thanks Georige..
Georgie WebberPosted Nov 27, 2012, 2:23 AM
Very nice conscription Deepak
Deepak MiddhaPosted Nov 19, 2012, 10:56 PM
Thanks sir..
Rohatash KumarPosted Nov 19, 2012, 2:05 AM
Nice Article. Keep it up.. Deepak