Tuesday, December 26, 2023

Next Report: Update Table

 


step 1: 


declare @sql varchar(max);



DECLARE @DateName nvarchar(100)


SET @DateName=  '[NextReport].[dbo].NXTRPTEmployeeProfile_' + CAST( GetDate()  as NVARCHAR(12) );

SELECT @DateName = REPLACE(@DateName, ' ', '')

 --SELECT @DateName

 Set @sql = 'SELECT * INTO ' +  @DateName +' FROM [NextReport].[dbo].NXTRPTEmployeeProfile ';


 EXECUTE(@sql)

 

 

 step 2: 

 

 Drop Table [NextReport].[dbo].[NXTRPTEmployeeProfile]

 

 

 Step: 

 if (SELECT count(1) FROM NXTActiveEmployee) > 0

BEGIN

SELECT 1

END

ELSE

BEGIN

TRUNCATE TABLE NXTActiveEmployee


INSERT INTO NXTActiveEmployee

SELECT EmployeeCode FROM Employee WHERE EmployeeStatus = 'A'

   

   END


Sunday, December 17, 2023

All Steps For Next Report Table Update

 



--Step : 1


declare @sql varchar(max);



DECLARE @DateName nvarchar(100)


SET @DateName=  'NXTRPTEmployeeProfile' + CAST( GetDate()  as NVARCHAR(12) );

SELECT @DateName = REPLACE(@DateName, ' ', '')

 

 Set @sql = 'SELECT * INTO ' +  @DateName +' FROM NXTRPTEmployeeProfile ';


 EXECUTE(@sql)




 --step 2: 


 Drop Table NXTRPTEmployeeProfile


 --step 3:


 SELECT * INTO NXTRPTEmployeeProfile FROM EmpProfile

 

NextReport Update Table

 declare @sql varchar(max);



DECLARE @DateName nvarchar(100)


SET @DateName=  '[NextReport].[dbo].NXTRPTEmployeeProfile' + CAST( GetDate()  as NVARCHAR(12) );

SELECT @DateName = REPLACE(@DateName, ' ', '')

 --SELECT @DateName

 Set @sql = 'SELECT * INTO ' +  @DateName +' FROM [NextReport].[dbo].NXTRPTEmployeeProfile ';


 EXECUTE(@sql)



 

Backup Tables by Date

 


declare @sql varchar(max);



DECLARE @DateName nvarchar(100)


SET @DateName=  'NXTRPTEmployeeProfile' + CAST( GetDate()  as NVARCHAR(12) );

SELECT @DateName = REPLACE(@DateName, ' ', '')

 

 Set @sql = 'SELECT * INTO ' +  @DateName +' FROM NXTRPTEmployeeProfile ';


 EXECUTE(@sql)


Screen Record

 Windows Screen Record WindowsKey+ Alt + R Recording Starts.