Create new table from old table and rebuild its indexes

osql -U sa

password: *****

1. Insert into already created table.

use <name-of-database>

insert into EQcust (*) select * from EQCUSTTemp;
go

2. Insert into a new table ( replicate a table)

use <name-of-database>

SELECT *
INTO EQtest
FROM EQCUSTTemp

3. Rebuild index online
use <name-of-database>

ALTER INDEX ALL ON EQCUSTTemp
REBUILD WITH(ONLINE = ON)

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s