create view [dbo].[AllUsers]
as
select u.UserId,
u.Firstname,
u.Lastname,
u.ts,
am.Email,
au.UserName
from dbo.aspnet_Membership am
inner join dbo.aspnet_Users au on au.UserId = am.UserId
inner join dbo.[User] u on u.UserId = au.UserId GO
怎么给视图增加一个字段:
CREATE OR REPLACE VIEW v2 AS SELECT id , price * num as 总价 , num* as 数量 from sheet1;
--这个 num* as 数量 创建的时候忘了创建,现在把他添加到v2视图中?
--重新执行一下就行了,视图v2会重新创建。 alter view v2 as select id, price..., number...其实很重新创建差不多。
-- 获得视图程创建语句
select o.xtype,o.name,cm.text from syscomments cm
inner join sysobjects o on o.id=cm.id
where xtype ='v'
order by o.xtype,o.name,cm.text