Código SQL:
Ver originalCREATE PROCEDURE dbo.procSelectGeneral
(@condiciones AS VARCHAR(200)
, @campos AS VARCHAR(300)
, @tabla AS VARCHAR(50) )
AS
BEGIN
DECLARE @str VARCHAR(8000)
SET @str = 'SELECT '+ @campos +' FROM '+@tabla
IF @condiciones<>''
BEGIN
SET @str = @str + ' WHERE ' @condiciones
END
EXEC(@str)
END
GO
Saludos!