--Use test db!
use test

--Get initial fragmentation info!
select * 
	from sys.dm_db_index_physical_stats(DB_ID(),object_id('orders'),NULL,NULL,'LIMITED')

--Create some fragmentation (takes about minute/minute and a half)
exec usp_fragmentpartition

--Get current framentation (note partition #4!)
select * 
	from sys.dm_db_index_physical_stats(DB_ID(),object_id('orders'),NULL,NULL,'LIMITED')

--Rebuild partition #4 only
alter index pk_orderid on orders
rebuild partition = 4

--See, all better
select * 
	from sys.dm_db_index_physical_stats(DB_ID(),object_id('orders'),NULL,NULL,'LIMITED')

--Rebuild whole thing
alter index pk_orderid on orders rebuild