|
|
|
SSChasing Mays
      
Group: General Forum Members
Last Login: Yesterday @ 12:21 PM
Points: 706,
Visits: 112
|
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Wednesday, March 17, 2010 5:51 PM
Points: 300,
Visits: 157
|
|
I dont know if i am wrong but is there a easy way out for this.
May be if i say.
Partition function fx(10,20,30) partition scheme sc on fx all to primary Create Table blabla_bla ( i int primary Key scheme fx(i))on fx(i)
create table blabla_bla_mirror( i int primary Key scheme fx(i))on fx(i))
switch partiton x to blabla_bla_mirror (x)
your partition is empty now
drop table mirror.
Regards Vinay
|
|
|
|
|
SSChasing Mays
      
Group: General Forum Members
Last Login: Yesterday @ 12:21 PM
Points: 706,
Visits: 112
|
|
Hi Vinay,
Yes, For truncating partition you need to create the mirror/dummy table with similar schema and on same file group where the partition is residing; and then use the Alter tables switch statement.
Dont you think that considerable manual work is involved here? This procedure automates the all the steps involved. You dont need to know about schema of the table, file group of the partition etc, you do not need to create and drop the dummy tables etc.
Also if you are migrating some code/database from Oracle to SQL Server where ALTER TABLE ..TRUNCATE PARTITION command is used, you can replace such statement by adding call to this procedure here.
Regards, Vidhyadhar
|
|
|
|
|
SSChasing Mays
      
Group: General Forum Members
Last Login: Yesterday @ 12:21 PM
Points: 706,
Visits: 112
|
|
One more thing is this procedure takes care if the partition is compressed. One more manual step is eliminated. If you are doing it manually you need to find out compression type of Partition and Mirror/Dummy table should have same Compression.
Regards, Vidhaydhar
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Wednesday, March 17, 2010 3:36 AM
Points: 1,
Visits: 2
|
|
Hello,
if i have a table containing an auto increment unique id, this table is partitioned based on date time field.
what happens to the auto increment values when i truncate a partition?
Will the partitions that are still available inherit the truncated id's or will the id continue incrementing as if nothing happened?
|
|
|
|
|
SSChasing Mays
      
Group: General Forum Members
Last Login: Yesterday @ 12:21 PM
Points: 706,
Visits: 112
|
|
Yes second option is correct. it will keep on incrementing from the last IDENTITY value.
|
|
|
|