• This seems to be the same thing as your loop.

    ALTER PROCEDURE [dbo].[uspNHistory]

    -- Add the parameters for the stored procedure here

    @NH_ID INT

    ,@N_ID INT

    AS

    DECLARE @CNID INT

    ,@CID INT

    ,@CA NVARCHAR(50)

    BEGIN

    -- SET NOCOUNT ON added to prevent extra result sets from

    -- interfering with SELECT statements.

    SET NOCOUNT ON;

    -- Insert statements for thisLoop

    INSERT INTO tblC2NHistory (

    NH_ID

    ,C2NID

    ,CID

    ,N_ID

    ,CA

    )

    SELECT @NH_ID

    ,CNID

    ,CID

    ,@N_ID

    ,CA

    FROM dbo.tblC2N

    WHERE NID = @N_ID

    END

    I would recommend that whenever possible you name your columns more verbosely. The super short abbreviations make it incredibly hard to work with and incredibly easy to make mistakes. It is possible these are all primary keys or something but they could still stand some clarity. Just my 2¢.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/