T-SQL 101: 138 Inserting Rows Returned by a SQL Server Stored Procedure
Another way you can get rows to insert into a table is by executing a stored procedure or, in fact, even by executing dynamic SQL. Either way, these both use an EXEC statement.
In the example shown, I’m doing an INSERT into the dbo.CinemaGroups table. I’ve declared the two columns that are being inserted. The stored procedure returns the rows that I want to insert.
This is again fairly easy to troubleshoot because the EXEC clause can usually be executed by itself, and you can see the rows coming back.
2025-04-01