Author |
Topic |
anhdet1989
Starting Member
4 Posts |
Posted - 2011-11-28 : 12:47:52
|
Hi all,My problem is: There are 2 table, table1(A,B,C) and table2(A,D). I want to create a view(A,B,C,D,E) where: A,B,C in view <-> A,B,C in table1 D in view <-> D in table2 E in view is a new column, E doesn't belong to both base table,table1 or table2. It can be?Thank you in advance. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-28 : 12:50:53
|
it can be. but in that case the table which E belongs needs to be related to any one of table1 or table2 in some way------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
anhdet1989
Starting Member
4 Posts |
Posted - 2011-11-28 : 13:24:16
|
Hi all,I solved my problem.Thank you. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-29 : 03:19:15
|
wc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
anhdet1989
Starting Member
4 Posts |
Posted - 2011-11-29 : 08:22:32
|
Hi visakh16,I have another problem. I want to update on a view but don't want to update on base table.With my above example: I want to update on column D of view(A,B,C,D) but I don't want to update on column D of table2(A,D). It can be?Thanks! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-29 : 11:25:10
|
quote: Originally posted by anhdet1989 Hi visakh16,I have another problem. I want to update on a view but don't want to update on base table.With my above example: I want to update on column D of view(A,B,C,D) but I don't want to update on column D of table2(A,D). It can be?Thanks!
what kind of update you want to do? more details please------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
anhdet1989
Starting Member
4 Posts |
Posted - 2011-11-29 : 13:02:07
|
quote: Originally posted by visakh16what kind of update you want to do? more details please
Hi visakh16,Thanks for quick reply. I want to update data in a VIEW but when I run UPDATE statement then not only UPDATE statement affect on VIEW but also it affect on BASED TABLE. How can to UPDATE statement just affect on VIEW.Thanks again. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-29 : 13:12:10
|
for that you shuld be using temporary table not a view since its a virtual table and any change to it will affect its base object.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|