Insert Problem | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Insert Problem

I have a record that was somehow deleted out of the database. I am not sure how it happened, and that is another story… Anyway, from a previous backup, I have the information for that record. But, since I am using the primary key field, I cannot just re-insert that row. How can I restore just a single row? I suppose I have to remove the constraint, then replace the constraint? Any suggestions on how do do this or anything I should be concerned about?
Am confused ! The primary key that you are using is it an identity element ?
If yes, then it shouldnt matter. Because the row if it was deleted, then the identity element would still be unique. If not, then update the remaining columns for that row. More over if you insert the record by removing the constraint and then try adding it, it wont allow to add the primary key constraint if the PK is not unique. Hope this helps.
Yes, it’s an identity element. It tells me the cell that contains the primary key cannot be modified.
I was also wondering if there might be a "with nocheck" option that I might be able to use?
It seems like I may have found my answer:
Use:<pre id="code"><font face="courier" size="2" id="code">set identity_insert &lt;table name&gt; on<br />insert into &lt;table name&gt; (&lt;all columns&gt<img src=’/community/emoticons/emotion-5.gif’ alt=’;)‘ /> values(…)<br />set identity_insert &lt;table name&gt; off</font id="code"></pre id="code">