首页 > 代码库 > Test20140811

Test20140811

CREATE PROCEDURE usp_P1(@TableName VARCHAR(200))ASBEGINSET NOCOUNT ON;DECLARE @sql NVARCHAR(200)SET @sql=SELECT * FROM +@TableName    EXEC(@sql)ENDGOALTER PROCEDURE usp_P2ASBEGINCREATE TABLE #TB1(ID INT)INSERT INTO #TB1SELECT 1UNION SELECT 2EXEC usp_P1 #TB1ENDGO