Click here to Skip to main content
15,894,265 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
if i want to create a procedure to truncate 12months old records in a table what could be the condition...?
like Set Month = Dateadd(month, -12, Dateadd(day, -1, @intr).

can you suggest..?
Posted
Updated 4-Dec-13 22:30pm
v2

1 solution

Try:
SQL
DELETE FROM MyTable WHERE MyDate < DATEADD(year, -1, GetDate())
 
Share this answer
 

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