select into: from stored procedure

  • Is it possible to do:

    select into tableName

     exec sp_proc

    Execute a sp and store the results in a table using select into.

    I need to column names and have to create a wrapper SP of the above type.

    Else need to rewrite a bunch of SPs and calling applications to send an additional parameter.

     

    I am on sqlserver 2000

    Thanks,

     

  • Chandrika - if I understand you correctly, then you cannot do a select into...where the table would just automatically take on the # of columns, datatypes etc. from the table you're selecting "from"...

    you could do an "insert into tableName exec sp_proc" if you create a table that matches the ddl of the # & type of columns being returned by your procedure.

    also to point out that you're in the sql2k5 forum and you "may" have quicker responses if you post in the sql2k forum..







    **ASCII stupid question, get a stupid ANSI !!!**

  • Hello Chandrika..

    This is a job for "the OPENROWSET trick," which you can find on my blog here.  This solution will work for either SQL Server 2000 or SQL Server 2005.

    Hope this helps..


    Take care..

    - Ward Pond
    blogs.technet.com/wardpond

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply