alter procedure sp_yh
@uid varchar(10),
@pwd varchar(20),
@qx int
as
insert into yh(用户名,密码,权限)
select * from yh where 用户名=@uid and 密码=@pwd and 权限=@qx这是我写的存储过程
exec sp_yh '22','',''
我执行时候,,为什么不能插入记录哦。。
@uid varchar(10),
@pwd varchar(20),
@qx int
as
insert into yh(用户名,密码,权限)
select * from yh where 用户名=@uid and 密码=@pwd and 权限=@qx这是我写的存储过程
exec sp_yh '22','',''
我执行时候,,为什么不能插入记录哦。。
@uid varchar(10),
@pwd varchar(20),
@qx int
as
insert into yh(用户名,密码,权限)
select 用户名,密码,权限 from yh where 用户名=@uid and 密码=@pwd and 权限=@qx
GO
--調用
exec sp_yh '22','',0
我是想插入记录到yh表中.
-----
但是你的存儲過程是將從yh表中查詢出來的紀錄,再插入到yh表中,這樣好象沒有什麼意義。另外,表中數據也會重復。
exec sp_yh '22','',1