• Thanks for taking a look at it John Mitchell-245523

    Managed to get it to work just now

    Turned out to be very simple - i had just missed off the select line at the end of the shared proc when trying to do it before

    For info if anyone is trying something similar this worked

    Shared Proc:

    create proc dbo.FormatIDs @ID int as

    DECLARE

    @ID1 TABLE (ID INT PRIMARY KEY, UNIQUE(ID))

    IF @ID = 0

    INSERT INTO @ID1

    SELECT ID

    FROM dbo.ID

    ELSE

    IF @ID IN (140, 144)

    INSERT INTO @ID1

    VALUES (140), (144)

    ELSE

    INSERT INTO @ID1

    SELECT @ID

    select ID from @ID1

    Reporting Proc:

    CREATE PROC dbo.ReportM1 @ID INT AS

    DECLARE

    @ID1 TABLE (ID INT PRIMARY KEY, UNIQUE(ID))

    insert into @ID1 exec dbo.FormatIDs @ID