Hi
I have created a workaround:
...
if month(getdate()) = '9'
delete FROM dbo.CounterData WHERE CounterDateTime like '%-07-%'
go
if month(getdate()) = '10'
delete FROM dbo.CounterData WHERE CounterDateTime like '%-08-%'
go
...
Running this statement for example on 1st day of September, will delete all data from july (month 07). It´s not the best way to do it, but it works. Assuming this runs every month, you guarantee that only one month of data will be available
I put this code (validating 12 months) in a SQL Agent Job running on 1st day of each month.
For now its what i need
Thanks a lot for all sugestions
Regards
...
Daniel
And you will have to do this every month. You need to solve the problem so that you may go on to other things.