optimize insert statement

  • hi guys!

    i want to hear some ideas from you. i'm performing an insert statement in this fashion:

    insert into worktable

    select A.column1

    from table1 A

    inner join table 2 B

    on A.key = B.key

    inner join table 2 C

    on A.key = C.key

    where A.key = 'something'

  • That's not enough information for us to go off of. Are there any triggers on the table? Locking Contention possibly? We need a bit more information about your environment.

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • Carla, the first thing I see is that unless your table only has one column, if you don't supply the column name into which you would like to insert the values, you will get an error like this

    Server: Msg 213, Level 16, State 4, Line 1

    Insert Error: Column name or number of supplied values does not match table definition.

    Greg
    _________________________________________________________________________________________________
    The glass is at one half capacity: nothing more, nothing less.

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

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