I created a new databases , and added tables using the import data wizard. But the wizard din't create the indexed and constraint's on the table. How can I Import indexes?
+1
A:
Just manually add indexes to your table
Here is an example from MSDN:
This example creates an index on the au_id column of the authors table.
SET NOCOUNT OFF
USE pubs
IF EXISTS (SELECT name FROM sysindexes
WHERE name = 'au_id_ind')
DROP INDEX authors.au_id_ind
GO
USE pubs
CREATE INDEX au_id_ind
ON authors (au_id)
GO
The other way you can do this is open the table in design mode management studio, highlight the field you want to index and look at the options at the top. One of them is for indexes and you can simply manually add it and give it a name right in management studio.
JonH
2010-07-19 19:44:27
+1
A:
If your source is also SQL Server, you should be able to run Tasks -> Generate Scripts and select "Script Indexes" in the list of options for the old database and execute the script on the new database with maybe a change in database name.
Andrew Flanagan
2010-07-19 19:48:10
But I have already created the tables and added data. Using generate scripts there is not option to create indexes on already existing table.
Pinu
2010-07-19 19:57:04
This would only work if your SOURCE was also a SQL Server database.
Andrew Flanagan
2010-07-19 20:13:27
@Pinu, you would generate a script and then run it on the new database.
Abe Miessler
2010-07-19 20:27:06