October 15, 2004 at 2:26 am
I have a data base , actually in one file.
I would like to move the tables in several files (fonction of application).
How to move with a precedure all tables in several files ?
October 15, 2004 at 12:08 pm
If you're asking how to split a single table into multiple data files, here is how I did it. I first created a temp table that mirrors the old table. Then you can add your indexes, specifying the file to use for each. This example puts the primary index on "SECOND" and the nonclustered index on "PRIMARY". I created SECOND through EM under the db properties (Data File tab). Then you can copy the data from the original table over and rename it to the original table name.
--create
ALTER TABLE dbo.Employees ADD CONSTRAINT
PK_Employees PRIMARY KEY CLUSTERED
(
EmployeeID
  ON [SECOND] --This is the new file
GO
CREATE NONCLUSTERED INDEX LastName ON dbo.Employees
(
LastName
  ON [PRIMARY] --this is the original file
GO
Darren
October 15, 2004 at 12:19 pm
Sorry about the wink face, replace with a end parenthesis and a semi-colon.
Darren
October 19, 2004 at 1:05 am
Thank,
how can I create a procedure for all tables ?
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply