how to create backup table

 USE [DellPII]

GO


/****** Object:  StoredProcedure [dbo].[SP_Databackuptables]    Script Date: 3/29/2022 10:42:20 AM ******/

SET ANSI_NULLS ON

GO


SET QUOTED_IDENTIFIER ON

GO






-----------------------------------------------------------------                                        

                                     

 --Initial Release: 22/02/2022     Author: Priyanka                                         

                                          

--                         

                                        

-----------------------------------------------------------------                                        

                                    

                                    

                                        

CREATE PROCEDURE [dbo].[SP_Databackuptables]                      

                                             

                                    

AS                                                  

BEGIN                                         

        

     

--SELECT * INTO Incident_SRMS_Specific_Backup 

--FROM  [172.16.123.70].ods.dbo.incident_SRMS_specific with(nolock)

--WHERE datasourceid = 42 and national_account_id in('42100372','43200131','43203872','44100131','44100162','44100730','44111022','44111322','44133532','44200171','45100371','47201271','49100472')--4727793


--SELECT IA.* INTO Incident_SRMS_Attention_Backup 

--FROM [172.16.123.70].ods.dbo.incident_SRMS_attention IA with(nolock) inner join [172.16.123.70].ods.dbo.incident_SRMS_specific I with(nolock)

--ON IA.incident_number = I.incident_number and  IA.datasourceid = 42 and I.national_account_id in ('42100372','43200131','43203872','44100131','44100162','44100730','44111022','44111322','44133532','44200171','45100371','47201271','49100472')--14414608


--SELECT II.* INTO Incident_Backup 

--from [172.16.123.70].ods.dbo.incident II with(nolock) inner join [172.16.123.70].ods.dbo.incident_SRMS_specific I with(nolock)

--ON II.incident_number = I.incident_number and  II.datasourceid = 42 and I.national_account_id in ('42100372','43200131','43203872','44100131','44100162','44100730','44111022','44111322','44133532','44200171','45100371','47201271','49100472')--4727790


--SELECT  I.* INTO Incident_SRMS_NOTES_Backup

--from [172.16.123.70].ods.dbo.Incident_SRMS_NOTES I with(nolock) inner join [172.16.123.70].ods.dbo.incident_SRMS_specific IT on I.attenno = IT.incident_number with(nolock)

--where IT.datasourceid = 42 and IT.national_account_id in('42100372','43200131','43203872','44100131','44100162','44100730','44111022','44111322','44133532','44200171','45100371','47201271','49100472')--4109332


--SELECT * INTO Fs_Serviceincidents_Backup 

--FROM [172.16.123.70].ods.dbo.Fs_Serviceincidents with(nolock) WHERE nationalaccount in ('0043200131','0045100371')--177370


--SELECT * INTO Incident_Srms_Backlog_Backup 

--FROM [172.16.123.70].ods.dbo.Incident_Srms_Backlog with(nolock)

--WHERE nationalaccount in ('0042100372','0043200131','0043203872','0044100131','0044100162','0044100730','0044111022','0044111322','0044133532','0044200171','0045100371','0047201271','0049100472')

 --3133733


--SELECT IT.* INTO Incident_Srms_Tsdb_Backup

--FROM [172.16.123.70].ods.dbo.Incident_Srms_Tsdb IT with(nolock) INNER JOIN [172.16.123.70].ods.dbo.incident_SRMS_specific I with(nolock)

--ON IT.incident_number = I.incident_number AND IT.datasourceid = 42 AND I.national_account_id IN ('42100372','43200131','43203872','44100131','44100162','44100730','44111022','44111322','44133532','44200171','45100371','47201271','49100472') --81339676

  


SELECT * FROM Incident_SRMS_Specific_Backup



             

END; 

GO



Comments

Popular posts from this blog

java chapter11 practice question on abstruct class and interfaces

DAY 12 -AZURE DP900(Microsoft Azure Data Fundamentals: Explore non-relational data in Azure)

java exercise4