Re: Execute a stored procedure and place results in a temporary table

From: Vishal Parkar (REMOVE_THIS_vgparkar_at_yahoo.co.in)
Date: 02/24/04

  • Next message: Mike Hoyt: "Arithmatic overflow with AVG?"
    Date: Tue, 24 Feb 2004 23:32:18 +0530
    
    

    hi alastair,

    --Two methods
    1) you will have to create a table first and then insert output of stored procedure using
    following syntax.

    insert into <table> exec <stored_procedure>

    create table #t(
    spid int null,
    ecid int null,
    status varchar(500) null,
    loginname varchar(500) null,
    hostname varchar(500) null,
    blk int null,
    dbname sysname null,
    cmd varchar(800) null)

    insert into #t exec sp_who

    2) without precreating the table you will have something as follows

    EXEC sp_serveroption <server name>, 'data access' , 'true'

    select *
    into #temptable
    from openquery (<server name>, 'exec sp_who')

    -- 
    Vishal Parkar
    vgparkar@yahoo.co.in
    

  • Next message: Mike Hoyt: "Arithmatic overflow with AVG?"

    Relevant Pages

    • Re: Problem using SP_TRACE_SETFILTER - it doesnt seem to apply th
      ... @bigintfilter and @intfilter input parameters) because of the nature of the ... @duration int, -- in minutes ... 1.04 - customised to capture specific information for PrecisDM ... exec master.dbo.xp_cmdshell @RenameCmd,NO_OUTPUT ...
      (microsoft.public.sqlserver.server)
    • Re: Disable Replication, remove rowguide-column?
      ... exec sp_configure N'allow updates', 1 ... DECLARE @username varchar ... FETCH NEXT FROM list_triggers INTO @name, ... create table syssubscriptions (artid int, srvid smallint, dest_db sysname, ...
      (microsoft.public.sqlserver.replication)
    • Re: unable to edit Index name?
      ... I've never been impressed with Enterprise Manager. ... id INT ... EXEC sp_helpindex blat ... CREATE INDEX bob ON guest.blat ...
      (microsoft.public.sqlserver.server)
    • Linux kernel sploit
      ... cibox login: chris ... enter: exec ./a.out 1062 ... int main ...
      (comp.os.linux.security)
    • Re: Spalte mit nullen =?ISO-8859-1?Q?auff=FCllen?=
      ... EXEC sp_executesql @sql,N'@p1 INT OUTPUT', @id OUTPUT ... SET @maxlaenge = @id ...
      (microsoft.public.de.sqlserver)