I have a stored procedure that gets data from different tables. I want a few fields from the result set of the stored procedure to be inserted on another table.
How can I do this? Cursor, another stored procedure or what?
You can insert the result set from a stored procedure into another table, as in this example from this article :
DECLARE @People TABLE
(
ContactID INT,
FirstName NVARCHAR(50),
LastName NVARCHAR(50)
)
INSERT @People (ContactID, FirstName, LastName)
EXEC dbo.GetPeopleByLastName @LastName = 'Alexander'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.