--Create A New Table
Create Table DemoTable
(Id Int,Name Varchar(40),Gender Char(1))
Go
--Insert Some Data
Insert Into DemoTable
Values (1,'Kuldeep','M'),(2,'Praveen','M'),(3,'Radhika','F')
Go
Select * from DemoTable
Go
--Create View With Select *
Create View vw_DemoTable
As
Select * From DemoTable
Go
Select * from vw_DemoTable
--Add New column Age to DemoTable
Alter Table DemoTable Add Age Int
go
Select Data From Both table and View and see the Difference. View Doesn’t Table Newly added column bydefault.
Select * from DemoTable – Table
Select * from vw_DemoTable -- View
Go
It Required View to Be Altered.
ALTER View [dbo].[vw_DemoTable]
As
Select * From DemoTable
GO
Select Data Again
Select * from DemoTable --Table
Select * from vw_DemoTable --View