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.
| Author |
Topic |
|
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2011-10-24 : 16:37:12
|
| I have 9 partition tables.Everyday a job will load the data in the one table.Partition1table First day loadPartition2table second day loadPartition3table third day loadPartition4table fourth day loadPartition5table fifth day loadPartition6table sixth day loadPartition7table seventh day loadPartition8table eight day loadPartition9table ninth day loadAfter ninth day load job in Partition9table..then next day Partition1table data should be truncated and load the new data on day 10 must be loaded in Partition1table.then next it should delete Partition2table ...so on. Like FIFO (FIRST IN FIRST OUT) after 9 loadHow should i acheive this with scripts.Thanks for your help |
|
|
Vinnie881
Master Smack Fu Yak Hacker
1231 Posts |
Posted - 2011-10-24 : 17:39:07
|
I think personally I would not use this partition table setup, but you could do it with simple if statements. Here is an example illustrating 30 days of operation.declare @day int,@i intset @day = 1set @i = @daywhile @day < 30begin if @i= 9 begin print cast(@day as varchar(20)) + ' partition9' end else if @i = 8 begin print cast(@day as varchar(20)) + ' partition8' end else if @i = 7 begin print cast(@day as varchar(20)) + ' partition7' end else if @i = 6 begin print cast(@day as varchar(20)) + ' partition6' end else if @i = 5 begin print cast(@day as varchar(20)) + ' partition5' end else if @i =4 begin print cast(@day as varchar(20)) + ' partition4' end else if @i = 3 begin print cast(@day as varchar(20)) + ' partition3' end else if @i = 2 begin print cast(@day as varchar(20)) + ' partition2' end else if @i = 1 begin print cast(@day as varchar(20)) + ' partition1' end set @day = @day + 1set @i = @i + 1 if @i > 9 begin set @i = 1 endend Success is 10% Intelligence, 70% Determination, and 22% Stupidity.\_/ _/ _/\_/ _/\_/ _/ _/- 881 |
 |
|
|
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2011-10-24 : 18:51:11
|
| Everday there is millions of record loaded instead of storing in one table because of performance issue I thoughtof partitions table switch would help.Can you suggest best possible solutions for my situation. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2011-10-24 : 19:27:34
|
| Actually i doing with table partition features.. |
 |
|
|
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2011-10-25 : 09:26:11
|
| thanksHow do i acheive with actual partitioned tables features. |
 |
|
|
|
|
|