Optimize Insert

  • I need to insert into a table , and define the type of each reocrd depending on some conditions ( These conditions are specified in join / where clause), so We are using about 10 inserts for same table as we have 10 diffrent types ( New, existing, pre-existing) etc.

    This is the current approach. Can any 1 suggest me any other alternative to insert the data froma coommon set of tables but with different join/ where conditions.

    Thanks in advance !

  • Can you post the current query you are using? We may need more, but that'd be a good place to start.

    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]

  • not sure if i'm following however give it a shoit. are u saying u have 10 different inserts to the same table. each insert has it's own select it is inserting and this select is the same as all the other 9 selects except for some minor changes to the where? If so then yes. u could probably combine all them into 1 insert as long as each select is using the same tables in their joins. u would have some pretty nasty case statements to handle the variations of the where and different on statements.

    You will need to post you inserts for anyone here to give u example on how to write it.

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

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