create procedure GetcountBytable
@table sysname
as
declare @Count int
declare @sql nvarchar(1000)
set @sql='select @Count=count(*) from ' + @table
exec sp_executesql @sql,N'@Count int out',@Count out
return (@count)

 

declare @i int
exec @i=GetcountBytable 'sysobjects'
select @i

 

相关文章:

  • 2021-06-18
  • 2021-08-22
  • 2022-12-23
  • 2021-10-08
  • 2021-11-25
  • 2021-08-11
  • 2021-12-08
猜你喜欢
  • 2021-11-27
  • 2021-12-02
  • 2021-12-29
  • 2022-01-28
  • 2021-05-17
  • 2021-10-22
  • 2021-11-06
相关资源
相似解决方案