How to move table of data Base in several files?

  • 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 ?

  • 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

    &nbsp ON [SECOND]  --This is the new file

    GO

    CREATE NONCLUSTERED INDEX LastName ON dbo.Employees

     (

     LastName

    &nbsp ON [PRIMARY]  --this is the original file

    GO


    Darren

  • Sorry about the wink face, replace  with a end parenthesis and a semi-colon. 


    Darren

  • 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