日期:2014-05-17 浏览次数:20894 次
ALTER view [dbo].vtest
as
select id=ROW_NUMBER()over(order by getdate()),* from test
GO
ALTER view vtest as select id=ROW_NUMBER() OVER(PARTITION BY GETDATE() ORDER BY city),city,code from test
if exists (select * from sys.objects where name ='test')
drop table test;
GO
create table test (city varchar(10),code varchar(10))
insert into test
select '广州','1111A' union all
select '深圳', '123A' union all
select '厦门', '159A'
GO
if exists (select * from sys.objects where name ='vtest')
drop view vtest;
GO
create view vtest as select id=ROW_NUMBER() OVER(ORDER BY GETDATE()),* from test;
GO