416 Part I EXAM PREPARATION INSERT INTO TitleAuthors

October 30th, 2009

416 Part I EXAM PREPARATION INSERT INTO TitleAuthors (au_id, au_lname, au_fname, phone, contract) VALUES ( 212-55-1212 , Burns , Bobby , 212 555-1212 , 1) After this, however, the Bobby Burns record will not be visible to the view. To then associate the new (non-visible) author with a blog, you have to UPDATE the TitleAuthor table, which cannot be done through the view, because those columns are not present in the view. References to the TitleAuthor table are used to create the view, but are not part of the column structure in the view. To properly satisfy the INSERT requirement for the Author table, the previous UPDATE to the TitleAuthors view had to UPDATE at least the au_id, au_lname, au_fname, phone, and contract columns because these columns are all set to not allow NULL values. The only piece of information that could have been left out of the INSERT would have been the phone column, because that defaults to ( UNKNOWN ). If you examine the view definition that was used in the TitleAuthor view, you will notice that it is a result of an INNER JOIN between three tables. This implements a restriction on the visible data. Other restrictions on the visible data may be the result of the WHERE clause. In the previous Bobby Burns INSERT, you were able to INSERT data that was then no longer visible to the view. You can confirm that Bobby Burns is in the Authors table by using SELECT * FROM Authors WHERE au_lname = Burns . The current view definition enables you to INSERT data that is not actually visible through the view. If you want to prevent this from happening, you can use the WITH CHECK OPTION when creating your view. Here is an example of the TitleAuthors view using the WITH CHECK OPTION: CREATE VIEW TitleAuthors AS SELECT dbo.authors.au_id, dbo.authors.au_lname, .dbo.authors.au_fname, dbo.authors.phone, .dbo.authors.contract, dbo.titles.title, .dbo.titles.type FROM dbo.authors INNER JOIN dbo.titleauthor ON dbo.authors.au_id = .dbo.titleauthor.au_id INNER JOIN dbo.titles ON dbo.titleauthor.title_id = .dbo.titles.title_id WITH CHECK OPTION Now if a similar data INSERT is attempted, you will receive the following error message: Server: Msg 550, Level 16, State 1, Line 1 The attempted insert or update failed because the target view either specifies WITH CHECK OPTION or spans a view

For high quality java hosting services please check java web hosting website.

Chapter 7 similar to adding data directly to

October 29th, 2009

414 Part I EXAM PREPARATION GO DROP VIEW

October 29th, 2009

Chapter 7 WORKING WITH VIEWS 413 .AuthorShortInfo, Line

October 28th, 2009

412 Part I EXAM PREPARATION ALTER VIEW EmployeeView

October 27th, 2009

Chapter 7 WORKING WITH VIEWS 411 the definition

October 26th, 2009

410 Part I EXAM PREPARATION Altering Views NOTE

October 26th, 2009

410 Part I EXAM PREPARATION Altering Views NOTE

October 25th, 2009

410 Part I EXAM PREPARATION Altering Views NOTE

October 24th, 2009

410 Part I EXAM PREPARATION Altering Views NOTE

October 24th, 2009