Skip to content

Instantly share code, notes, and snippets.

View dcs619's full-sized avatar

David Stevens dcs619

View GitHub Profile
@dcs619
dcs619 / gist:cd0a7682c4a33b06dc3fb9891e7f401e
Last active April 8, 2016 18:12 — forked from dalenewman/gist:6377911
A T-SQL stored procedure for moving an index from one file group to another. The original script was found at http://blogs.msdn.com/b/ramoji/archive/2008/09/26/how-to-move-existing-indexes-from-one-filegroup-to-another.aspx and updated according to responses found on the same page.
/*
-- See below for moving a non-clustered file index. Moving a clustered index is the same
-- as moving the data, as each row lives as a leaf somewhere in the index tree.
-- Current syntax for moving a CLUSTERED file index:
PRINT 'Moving PK_dbo.Group index'
CREATE UNIQUE CLUSTERED INDEX
[PK_dbo.Group]
ON
[Group] ( [Id] )