Hello,
How to copy one record from sourcetable.sourceDB to Destinationtable.DestinationDb in sql
By mistaken I deleted the record from destination table and I need to bring back that one record from source table>sourceDB.
Hello,
How to copy one record from sourcetable.sourceDB to Destinationtable.DestinationDb in sql
By mistaken I deleted the record from destination table and I need to bring back that one record from source table>sourceDB.
Could you please validate all the answers so far and provide any update?
If all of them are not working or helpful, please provide more sample data or details about your issue.
Please remember to accept the answers if they helped. Your action would be helpful to other users who encounter the same issue and read this thread.
Thank you for understanding!
If there is no auto-increment column in your target, you can refer to the code of RyanAbbey-0701. If there are auto-increment columns in your target table, please refer to:
INSERT INTO Destinationtable(Non-incremental1,Non-incremental2,Non-incrementaln)
SELECT Non-incremental1,Non-incremental2,Non-incrementaln
FROM sourcetable
WHERE <rule to identify that one record>
If you have any question, please feel free to let me know.
Regards
Echo
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
do they have the same schema? Are they on the same server?
If so,
insert into <destination>
select * from <source>
where <rule to identify that one record>
Alternatively, in the likes of SSMS, run the select statement in your source database, on the results pane, right click and copy (can't remember exactly the steps to walk through), a window should open in which you can choose to copy as an insert statement. Take the copy then go to your destination server and paste the statement, change to destination table and any other fields that need to change
13 people are following this question.