I have a database “DB” and I want to delete records from table “MyRecords” which are of future (“RecordDates” which are more than today just to avoid date change on system) and less than x no. of days from today.
That “x” may vary. Moreover, I want to execute same type of command with month and year also.
I am using SQL Server and C#.
To delete records which are in the future and less than
ndays in the future you could use T-SQL such as this:In this case
nis 5.You can see all the arguments to
DATEADD()at DATEADD (Transact-SQL)