insert a value AND the results of an exec.

  • Is it possible to do this:

    table1 =

    id, date

    proc1 returns the date

    insert table1 values (1, exec proc1)

    i know i can insert into just the date & come back after for the id, but is it possible to achieve both in 1 insert?

    thanks.

  • Not unless you can implement the logic in the proc as a function.

    Jayanth Kurup[/url]

  • if you cannot use the builtin getdate() function for the current date and time,

    you can stick the results into a temp table, and insert from there as well.

    CREATE TABLE #temp(ColumnList...)

    INSERT INTO #temp

    EXEC (Proc1)

    INSERT INTO AnotherTable(OtherColumn,ColumnList)

    SELECT 1,ColumnList from #temp

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

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

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