• ron.mcdowell,

    I've set @Cmd to NVARCHAR(MAX), the limitations of sp_executesql are only that of server memory or 2GB.

    The number of rows is irrelevant as the @Cmd value only has the column list and makeup for extracting the column values. E.g.

    SELECT 'INSERT INTO dbo.MyTable (Col1, Col2, Col3) VALUES (' + Col1+ ', ' + Col2 + ', ' + Col3 + ')'

    FROM dbo.MyTable

    Providing this fits into @Cmd there is no limitation, the actual values are no set in @Cmd.

    Hopefully that makes sense.