Hi @Qamar, Mo ,
Thank you so much for posting here.
The easiest way is to define the MyNewTable table and insert the result of procedure into this table.
CREATE TABLE MyNewTable (...);
INSERT INTO MyNewTable
EXEC GetProductDesc;
If you would like not to define this new table manually, you could refer dynamic way provided by Viorel.
In addition, you could also use OPENROWSET method mentioned by Guoxiong.
I've also included the sp_configure code to enable Ad Hoc Distributed Queries, in case it isn't already enabled.
sp_configure 'Show Advanced Options', 1
GO
RECONFIGURE
GO
sp_configure 'Ad Hoc Distributed Queries', 1
GO
RECONFIGURE
GO
SELECT
*
INTO
MyNewTable
FROM
OPENROWSET (
'SQLNCLI',
'Server=localhost;Trusted_Connection=yes;',
'SET FMTONLY OFF;EXEC [dbname].dbo.GetProductDesc;'
);
Best regards
Melissa
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Hot issues October--Users always get connection timeout problem when using multi subnet AG via listener. Especially after failover to another subnet