在企业管理器中编写一个用来求student表中的学生人数的存储过程的存储过程,在这个student表中有学号,姓名,籍贯和年龄.要是在employee表还好可以通过工资来求,可是在这里我就不知道怎么办了??
------解决方案--------------------
create proc test @name sysname--表名
as
exec( 'select count(*) from '[email protected])
exec test '表名 '
------解决方案--------------------
create table student(学号 nvarchar(10), 姓名 nvarchar(10), 籍贯 nvarchar(10), 年龄 int)
--创建
CREATE PROCEDURE eget
(
@学号 varchar(50),
@mycount int output
)
AS
select @mycount=count(*)
from student
where [email protected]
go
--调用
declare @bget int
exec eget '学号 ',@bget output
print @bget
--没有错啊