刚才想写个存储过程,想不起语法了。在网上查了查找到了!!
写完了又忘了怎么调用了 !晕死!···
赶快写个简单备忘·······················
select * from login
select * from userinfo
select max(id) from login
select * from login a,userinfo b where a.id=b.id
--创建视图
create view LogAndUser
as
select a.id,a.uname,a.upwd,a.lasttime,b.turename,b.age from login a,userinfo b where a.id=b.id
--修改视图
alter view LogAndUser
as
select a.id,a.uname,a.upwd,a.lasttime,b.turename,b.age from login a left join userinfo b on a.id=b.id
--测试视图
select * from LogAndUser
--创建存储过程
alter proc TestProc
(
@id int
)
as
(
select * from login where id=@id
)
--测试存储过程
exec TestProc 3