Sql updating table values
Using a view to filter data on the server is much more efficient than fetching an entire table and then applying a filter on the client. One reason it's recommended that the dbo own all objects in a database is that problems arise when the chain of ownership is broken.
To restrict the rows in a view, you use the same kinds of criteria in a clause. This happens when the view and the underlying table do not have the same owner.
To return the top 10 customers or the top 10% of customers, based on sales over the past year, SQL Server needs to sort customers by sales.
So, a view that returns the top 100% by sales would essentially be a sorted view.
A user can query a single view instead of having to learn complex join syntax and understand the structure of your database.
Another limitation of views that you may be familiar with is that a view cannot be indexed. In SQL Server 2000, you can indeed create indexed views, as shown later in this chapter.Tables can be customized and tailored to the needs of the users by way of views. All permissions can be removed from the underlying tables, and as long as the owner of the table is the same as the owner of the view, the user will be able to interact with the data based on the permissions granted to the view.For example, you could create a view for a salesperson that only displays her own orders, or you might create a view for the manager, who is only interested in seeing the total sales for each salesperson. Figure 9.1 shows the Permissions dialog box for vw Customeraddress List.Similar performance benefits can be gained with SQL Server by basing your reports on views. A simple solution to the issue of implementing row-level and column-level security is to revoke all permissions to the underlying tables.For example, the following view selects a customer's total orders and contains joins between the Customers table, the Orders table, and the Order Details table. Instead, define views with only selected columns to implement column-level security and define views with a clause to implement row-level security.