I have developed the following code:
CREATE PROCEDURE [dbo].[Test01]
AS
BEGIN
SELECT * FROM TestTable
END
CREATE PROCEDURE [dbo].[Test02]
AS
BEGIN
DECLARE @tmp TABLE
(
TestID int,
Test nvarchar(100),
)
INSERT INTO @tmp
EXEC Test01
SELECT COUNT(*) FROM @tmp
END
But if I add or remove a column on TestTable
I must to modify @tmp
otherwise the result is:
Column name or number of supplied values does not match table definition
How can I solve this problem?