Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 BUG IN SQL SERVER 2000

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-02-28 : 08:22:26
PUNEET writes "THE FILEGROUP OF THE TABLE CHANGES BACK TO PRIMARY ON ADDING PRIMARY KEY TO THE TABLE.
STEPS TO REPRODUCE

1 CREATE A FILEGROUP ON THE DATABASE.
2. CREATE A TABLE WITH "CREATE TABLE" SYNTAX FROM ANALYSZER, WITH THIS NEW FILEGROUP.
3. FROM ENTERPRISE MANAGER, ADD THE PRIMARY KEY TO THE TABLE.
4. CHECK THE PROPERTIES AND THE FILEGROOUP HAS BEEN CHANGED TO PRIMARY RATHER THAN WHAT WE SPECIFIED.

THANKS,
PUNEET
PARASHAR22@HOTMAIL.COM"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-02-28 : 08:36:47
Nope, that's not a bug. Enterprise Manager will use the default filegroup whenever you add an index or constraint, unless you specifically tell it otherwise. If the primary filegroup is the default, this is perfectly normal behavior. If the primary key is also the clustered index (which is the default) this will move the data to the default filegroup if another filegroup is not specified. Look at the CREATE TABLE and ALTER TABLE commands in Books Online for the syntax that adds constraints.

Try changing the default filegroup for the database and adding the primary key. You'll see that the table is moved to the default filegroup, as expected. I just did this several times in EM and query analyzer and it worked as expected.

Edited by - robvolk on 02/28/2002 08:46:10
Go to Top of Page
   

- Advertisement -