In this post, we will see how to make a perspective programmatically in SQL Hosting server 2012. View is determined as an exclusive desk with information from various platforms in the data source. Opinions are most regularly used to offer protection because it guarantees that an individual can only accessibility the information they are designed to accessibility and any staying information is neither seen nor can be utilized by them. The staying information is thereby instantly secured from undesirable customers. So let's take a look at a realistic example. The example is designed in SQL Hosting server 2012 using the SQL Hosting server Control Facilities
.Create a view programmatically
Syntax
CREATE VIEW view_name (column_name1,column2..)
WITH ENCRYPTION
AS
select_statement [WITH CHECK OPTION ]
I have two platforms known as User Detail and User Table. Both have a different pillar. Now I want to recover a pillar from the first (the UserDetail) desk and some content from the second (the User Table) desk.
First Table:
Second Table:
Now the following query defines the view:
CREATE VIEW Detail
AS
(
SELECT dbo.UserDetail.User_Id, dbo.UserDetail.FirstName, dbo.UserDetail.LastName,dbo.UserTable.ID, dbo.UserTable.Name
FROM dbo.UserDetail CROSS JOIN
dbo.UserTable
)
Now Press F5 to execute the query.
OUTPUT
ALTERING View
Using the ALTER VIEW statement you can modify a view without dropping it. We can modify the view using the following query:
ALTER VIEW view_name
AS
SELECT statement
DROPPING View
We can delete the view using the drop command as follows:
DROP VIEW view_name
DROPPING Multiple Views
You can drop a single view or multiple views at a time.
Syntax
Syntax
DROP VIEW view_name1, view_name2,..
SPONSORS:
No comments:
Post a Comment