March 12, 2012 at 6:47 pm
Hugo Kornelis (3/12/2012)
...And if the view includes the WITH CHECK option, those people would also be unable to change active members to non-active members.
I am not sure to understand perfectly the WITH CHECK option. From microsoft, I found that "WITH CHECK option" is:
"Forces all data modification statements that are executed against the view to follow the criteria set within select_statement."
So, If I understand well, all column from the view are protected against updates, but you can delete any row from the view (if it does not have reference constraint) or insert a new row ( if the view covers all "not null" columns). Is that it? That could be neet...
March 13, 2012 at 1:50 am
tilew-948340 (3/12/2012)
I am not sure to understand perfectly the WITH CHECK option.
Put simply, WITH CHECK means that rows that are inserted or updated through the view must still satisfy the view's predicate. In other words, if you do an insert or update through the view and then a select immediately after it, you should see the updated or inserted row.
Example:
CREATE VIEW SalesPpl
AS
SELECT EmpNo, Name, Salary, Department
FROM Personnel
WHERE Department IN ('Sales', 'SalesBackOffice');
The view above allows people to add personnel into the Marketing department, or to update a row to transfer someone from Sales to Accounting. The WITH CHECK option prevents that, while still allowing users to update a row to transfer people between Sales and SalesBackOffice.
March 13, 2012 at 3:22 pm
Got any more like this Ron?
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
March 13, 2012 at 3:35 pm
SQLRNNR (3/13/2012)
Got any more like this Ron?
ONe more called VIEW 3 scheduled for the 20th of March and 2 more pending have been submitted .. waiting to be scheduled.
March 13, 2012 at 5:31 pm
Hugo Kornelis (3/13/2012)
...The view above allows people to add personnel into the Marketing department, or to update a row to transfer someone from Sales to Accounting. The WITH CHECK option prevents that, while still allowing users to update a row to transfer people between Sales and SalesBackOffice.
oh... it was not what I tought...good thing I ask 😀
So much to learn... so much to understand...so much to remembered...
good thing you are there!
Thanks Hugo for the precision!
Thanks bitbucket for the question!
March 14, 2012 at 12:31 pm
tks Ron
March 14, 2012 at 7:50 pm
Good question. Thanks for submitting.
http://brittcluff.blogspot.com/
March 16, 2012 at 2:54 am
:hehe:
March 16, 2012 at 2:58 am
I think the question is a bit obvious
Why?
1) It is a view not a table. If you want to delete any columns, you can do it by excluding from view
2) It is a view so use view as a view not as a table
August 2, 2012 at 5:56 am
wasn't obvious for me. never thought that it is possible to delete data in a view
October 10, 2012 at 3:34 am
very good question...
unfortunately I checked wrong answer 🙁
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
January 10, 2013 at 6:34 am
Nice One..
--
Dineshbabu
Desire to learn new things..
January 5, 2015 at 1:57 am
Very good question, thanx.
Thanks & Best Regards,
Hany Helmy
SQL Server Database Consultant
Viewing 13 posts - 16 through 27 (of 27 total)
You must be logged in to reply to this topic. Login to reply