studentRNo, studentName, StudentAddress
now we have create a view on it like:
create view viewName
as
select * from tblstudent
now when we will perform select operation on view then it will show us columns:
select * from viewName
output:
studentRNo, studentName, StudentAddress
now we have added a new column to tblstudent named 'studentFee'
alter table tblstudent add StudentFee int
now when we will run select operation on view again like:
select * from viewName
it will show use only those three columns which was exists while creating view:
select * from viewName
output:
studentRNo, studentName, StudentAddress
so as we are using '*' in query so it should show the newly added column in result but it will not show it. so to get desired result you will have to use a system storedprocedure 'sp_refreshView'
sp_refreshView 'ViewName'
and its done.
select * from viewName
output:
studentRNo, studentName, StudentAddress, studentFee
Solution by
No comments:
Post a Comment