We help IT Professionals succeed at work.

Could you check if is this a valid way to replace data from a restore database to the current database by using MSSQLServer?

78 Views
1 Endorsement
Last Modified: 2019-02-16
Hi Experts

Could you check if is this a valid way to replace data from a restore database to the current database by using MSSQLServer?

I need to replace a range of lines that is incorrect on the current database by using the restore database, I'm planning to do that:
-- -------------------------------------------------------------------------------------
-- Deleting the lines from target database
DELETE FROM INFOSAUDE.dbo.assistido a WHERE WHERE cpf ='';

-- Insert correct lines from RESTORE database

INSERT INTO INFOSAUDE.dbo.assistido a
  SELECT a2.id_assistido FROM INFOSAUDE_REST1302.dbo.assistido a2  WITH(NOLOCK) WHERE cpf ='';
-- -------------------------------------------------------------------------------------

Open in new window


Could you check?

Thanks in advance!
Comment
Watch Question

Database Analyst
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Eduardo FuerteDeveloper and Analyst

Author

Commented:
Thank you for reply.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.