November 16, 2004 at 2:31 pm
easy newbie question:
I am writing a SP to update a complex view. Do I update each underlying
table individually or can I update the view itself? The FE is Access and I
know that views are for all practical purposes not updateable from Access. So
if I have 5 or 6 tables involved, it doesn't make sense to me that the view
is updateable from SQL when it's not in Access.
Thanks for the help!
I don't want to use an "instead of" event on the view, or a trigger.
--
November 18, 2004 at 9:21 am
In SQL Server, some views are updatable. Here are some of the rules (quoted from Books Online, topic "CREATE VIEW", paragraph "Updatable views"):
If a view does not have INSTEAD OF triggers, or if it is not a partitioned view, then it is updatable only if the following conditions are satisfied:
CREATE VIEW NoTable AS
SELECT GETDATE() AS CurrentDate,
@@LANGUAGE AS CurrentLanguage,
CURRENT_USER AS CurrentUser
INSERT, UPDATE, and DELETE statements also must meet certain qualifications before they can reference a view that is updatable, as specified in the conditions above. UPDATE and INSERT statements can reference a view only if the view is updatable and the UPDATE or INSERT statement is written so that it modifies data in only one of the base tables referenced in the FROM clause of the view. A DELETE statement can reference an updatable view only if the view references exactly one table in its FROM clause.
Razvan
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply