Thursday, January 5, 2023

SQL Server - Stored Procedure Into table

Here some steps to capture the procedure's output into temp table.  


CREATE PROC BlogByPrimaryAuthor

  @PrimaryAuthor nvarchar(10)

AS

BEGIN

  SELECT

    *

  FROM

    OnlineBlog

  WHERE

    AuthorName = @PrimaryAuthor;

END

GO


-- Now We are here to create temp table with matching columns and its definition.


CREATE TABLE #tmpOnlineBlog (ID INT, ArticleNo NVARCHAR(100),AuthorName Varchar(25),BlogURL nvarchar(Max))


INSERT INTO #tmpOnlineBlog

EXEC BlogByPrimaryAuthor 'AmitVaid'

GO




Best Regards

Amit Vaid

Note:- The 'STOP' itself deserves to initiate STart.

No comments: