O'Reilly logo

SQL Server 2014 with PowerShell v5 Cookbook by Donabel Santos

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Moving an index to a different filegroup

This recipe illustrates how to move indexes to a different filegroup.

Getting ready

Using the TestDB database, or any database of your choice, let's create a table called Student with a clustered primary key.

Open SQL Server Management Studio and execute the following code:

USE TestDB GO -- this table is going to be stored to -- the default filegroup IF OBJECT_ID('Student') IS NOT NULL DROP TABLE Student GO CREATE TABLE Student ( ID INT IDENTITY(1,1) NOT NULL, FName VARCHAR(50), CONSTRAINT [PK_Student] PRIMARY KEY CLUSTERED ([ID] ASC) ) GO -- insert some sample data -- nothing fancy, every student will be called Joe for now :) INSERT INTO Student(FName) VALUES('Joe') GO 20 INSERT INTO Student(FName) SELECT ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required