改成这样试试:
CREATE Procedure [dbo].[P_Report_System]
(
@where nvarchar(500)
)declare @sql nvarchar(4000)set @sql = 'select * from 表 where 1=1 '+@whereexec(@sql)
goEXEC P_Report_System ' and ecoa.codename = ''C'' '
CREATE Procedure [dbo].[P_Report_System]
(
@where nvarchar(500)
)declare @sql nvarchar(4000)set @sql = 'select * from 表 where 1=1 '+@whereexec(@sql)
goEXEC P_Report_System ' and ecoa.codename = ''C'' '
(
@where nvarchar(500)
)
as
DECLARE @sql nvarchar(max)
SET @sql='select *
from sys.sysprocesses
where 1=1 '+@where
EXEC(@sql)
EXEC P_Report_System ' and ecoa.codename = ''C'' '