Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Update / Insert / Delete on VIEW

Author  Topic 

mahesh_bote
Constraint Violating Yak Guru

298 Posts

Posted - 2007-02-22 : 09:10:48
i have create one view on one table. i have used self join in it. i tried to insert values in it. it showing me the error:

Server: Msg 4405, Level 16, State 2, Line 1
View or function <VIEW> is not updatable because the modification affects multiple base tables.

i know, if u use any JOINs in views, they are not updatable. but here i have only one table with self join.

does SQL server doesn't support insertion / updation / deletion in such case?

Mahesh

Kristen
Test

22859 Posts

Posted - 2007-02-22 : 09:20:02
"but here i have only one table with self join"

That will be the problem then!!

If you want to insert to that VIEW you will have to create an INSTEAD OF trigger on it.

IMHO I would not recommended that though ...

Kristen
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-22 : 09:20:18
Self joining is still a JOIN.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -