首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

给个简单的思路,怎么计算啊

2012-02-03 
给个简单的思路,如何计算啊??在企业管理器中编写一个用来求student表中的学生人数的存储过程的存储过程,在

给个简单的思路,如何计算啊??
在企业管理器中编写一个用来求student表中的学生人数的存储过程的存储过程,在这个student表中有学号,姓名,籍贯和年龄.要是在employee表还好可以通过工资来求,可是在这里我就不知道怎么办了??

[解决办法]
create proc test @name sysname--表名
as
exec( 'select count(*) from '+@name)

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 学号=@学号
go

--调用
declare @bget int
exec eget '学号 ',@bget output
print @bget

--没有错啊

热点排行
Bad Request.