Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2010
    Posts
    4

    create output of strored procedure into a table

    Hello everyone

    please have a look at the code below

    create table tab1
    (
    int1 int null,
    int2 int null
    )

    insert into tab1 values (11,22)
    insert into tab1 values (33,44)
    insert into tab1 values (55,66)

    CREATE PROC test_proc
    AS
    SELECT int1, int2 from tab1

    create table tab2
    (
    int11 int null,
    int22 int null
    )

    I would like to run test_proc and store the values to tab2. please help witht the query.

    Something like insert into tab2 exec test_proc -- which obviously does not work.

    I'm using sybase 15

    Thanks in advance.

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,353
    Create a proxy table on the proc, then insert into the new table by selecting from the proxy table.

  3. #3
    Join Date
    Mar 2008
    Posts
    96
    I am not sure but i guess there is a limitation in SP that DDL commands can't be executed from within a SP.

    Regards
    Ishu

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •