阅读背景:

如何通过动态传递表名来获取行数

来源:互联网 
create procedure qa_cc
@tablename varchar(500)

AS 

BEGIN
    -- Create two integer values
DECLARE @tableOneCount varchar(50), @tableTwoCount varchar(50)

-- Get the number of rows from the first table
SELECT @tableOneCount = 'SELECT COUNT(*) FROM'  + @tablename; 
    exec (@tableOneCount);           

select      @tableOneCount  ; 

END

exec qa_cc @tablename=table1
create procedure qa_cc
@tablename varchar(500)



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: