Creating a Primary Key on a temp table - When?

后端 未结 9 684
一个人的身影
一个人的身影 2020-12-29 04:16

I have a stored procedure that is working with a large amount of data. I have that data being inserted in to a temp table. The overall flow of events is something like

9条回答
  •  情深已故
    2020-12-29 04:41

    Even more important than performance considerations, if you are not ABSOLUTELY, 100% sure that you will have unique values being inserted into the table, create the primary key first. Otherwise the primary key will fail to be created.

    This prevents you from inserting duplicate/bad data.

提交回复
热议问题