troubleshooting Question

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

Avatar of Eduardo Fuerte
Eduardo FuerteFlag for Brazil asked on
DatabasesMicrosoft SQL Server
2 Comments1 Solution86 ViewsLast Modified:
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 ='';
-- -------------------------------------------------------------------------------------

Could you check?

Thanks in advance!
ASKER CERTIFIED SOLUTION
lcohan
Database Analyst

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros