Click here to Skip to main content
15,170,741 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a database named " time_DB". i duplicate and rename it to "time_DB2"

this week , i made some modifications on the first database " Time_DB " , and made another modifications on the database 2 "Time_DB2".

how can i transfer the modifications made this week from the first database to the other one . i'm using SQL SERVER 2019 PRO

What I have tried:

I generate script but i haven't find a way to specify the date because i only need modifications made this week.
Posted
Updated 14-Sep-21 1:03am

1 solution

Use a WHERE clause with a BETWEEN:
SQL
... WHERE InsertDate BETWEEN DATEADD(ww, -1, GETDATE()) AND GETDATE()
That'll take you back seven days.
If you need the week more accurately, you'll need to play with the current day of the week and subtract that as well to math you local and / or company week start day: DATEPART (Transact-SQL) - SQL Server | Microsoft Docs[^]

[edit]
I was thinking about this, and wrote this, which may help: Fetching data from a specific week relative to a date in SQL[^]
[/edit]
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900