我想写个函数,参数是一个自定义的表名,返回这个表的行数
------解决方案--------------------
create function backtoCount(@tablename varchar(50))
returns int
as
begin
declare @count int
select @count=rows from sysindexes where indid in (0,1) and object_name(id)[email protected]
return @count
end
GO
--查sysobjects表有多少行
select dbo.backtoCount( 'sysobjects ')