当前位置: 代码迷 >> Sql Server >> MS_SQL的函数有关问题,
  详细解决方案

MS_SQL的函数有关问题,

热度:15   发布时间:2016-04-27 17:35:12.0
MS_SQL的函数问题,高手进啊
我想写个函数,参数是一个自定义的表名,返回这个表的行数

------解决方案--------------------
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 ')
  相关解决方案