Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Archiving data?

Author  Topic 

mem
Starting Member

28 Posts

Posted - 2004-08-12 : 20:50:49
Hello,

I'd like copy/move data from one table to another every 13 months. So, the year starts on 02/01/2004 and ends on 01/31/2005. The procedure would need to occur on the last day of the 13th month.

Does that make sense?

Thanks.

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-08-12 : 21:10:52
It makes sense. Is that your question?
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2004-08-13 : 03:42:19
Go to Top of Page

mem
Starting Member

28 Posts

Posted - 2004-08-13 : 15:49:32
Funny...but no. Thanks for the help tho.
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-08-13 : 15:53:22
so what's keeping you from scheduling a job at the day/time you want???

Go with the flow & have fun! Else fight the flow :)
Go to Top of Page

mem
Starting Member

28 Posts

Posted - 2004-08-13 : 15:57:34
Scheduling a job would be required. I guess i was looking for help on the t-sql to achieve the procedure.
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-08-13 : 17:13:34
Well, assuming you have a date on EVERY table, you would just use BETWEEN the appropriate dates. I'm assuming it's a little more complicated then that though. This kind of thing takes a lot of planning normally. You have to figure out what is a valid archivable field.

Example: If you have a loan system. The loan was approved on 01/29/04, funded on 01/30/04, and had an adjustment made on it 02/01/2004. Do you archive it? You need to have a whole list of criteria inspected to just determine what data can be archived. After this, you have to go through the dependency order and determine the order of moving the data out.

This is why archiving is usually customized per environment. Each business will have different requirements, controls, etc. I still don't think we're answering your question. You need to give us what you have come up with, then ask specific questions.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2004-08-13 : 20:07:21
If it's about finding out the last day of the 13th month...
then:

declare @year_starts datetime
set @year_starts = '02/01/2004'
select dateadd(mm,datediff(mm,0,@year_starts)+13,0)-1 as last_day_of_month_13

/rockmoose
Go to Top of Page
   

- Advertisement -