Change Primary Key SQL
Change Primary Key in Sql Server 2005 .
Change Primary Key in Sql Server 2008.
Change PK from Clustered to NonClustered in Sql Server.
Just this morning I encountered a problem in my database performance.
It appears like the person who created the table created the primary key as a clustered one, without thinking of what will be in the future and the purpose of the Id PK in the table.
After digging the web, I found this great answer which gave me the hint for the desired solution:
This solves it :)
p.s.
it takes some time to drop and re-index everything.
Elad Shalom,
CTO at ITweetLive.com
Change Primary Key in Sql Server 2008.
Change PK from Clustered to NonClustered in Sql Server.
Just this morning I encountered a problem in my database performance.
It appears like the person who created the table created the primary key as a clustered one, without thinking of what will be in the future and the purpose of the Id PK in the table.
After digging the web, I found this great answer which gave me the hint for the desired solution:
use MyDB
DROP INDEX MyTable.IX_MyTable_FamilyName
ALTER TABLE MyTable
ADD CONSTRAINT UQ_TableX UNIQUE(Id)
ADD CONSTRAINT UQ_TableX UNIQUE(Id)
ALTER TABLE MyTable
DROP CONSTRAINT PK_MyTable
DROP CONSTRAINT PK_MyTable
ALTER TABLE MyTable
ADD CONSTRAINT PK_MyTable PRIMARY KEY NONCLUSTERED(Id)
ADD CONSTRAINT PK_MyTable PRIMARY KEY NONCLUSTERED(Id)
ALTER TABLE MyTable
DROP CONSTRAINT UQ_TableX
DROP CONSTRAINT UQ_TableX
CREATE NONCLUSTERED INDEX IX_MyTable_FamilyName ON MyTable(FamilyName)
This solves it :)
p.s.
it takes some time to drop and re-index everything.
Elad Shalom,
CTO at ITweetLive.com
nike free, louis vuitton outlet online, chanel handbags, oakley sunglasses, burberry outlet online, air max, tiffany and co, ray ban, prada outlet, ray ban sunglasses, burberry outlet online, louboutin, longchamp outlet, louboutin, coach outlet store, polo ralph lauren outlet, oakley sunglasses, jordan shoes, oakley sunglasses, coach factory outlet, coach outlet, nike shoes, michael kors outlet, gucci outlet, coach purses, coach factory, tory burch outlet, prada handbags, oakley sunglasses, toms shoes, louis vuitton handbags, true religion jeans, true religion outlet, kate spade outlet, ray ban sunglasses, true religion, polo ralph lauren, nike air max, oakley sunglasses, michael kors outlet
ReplyDeletejianbin0623
ReplyDeletepolo shirts
rolex watches
christian louboutin uk
kate spade uk
ferragamo shoes
nike air max 90
michael kors outlet online
jordan shoes 2015
fitflops clearance
toms outlet
cheap oakley sunglasses
true religion outlet
ralph lauren polo shirts
tiffany and co
basketball shoes,basketball sneakers,lebron james shoes,sports shoes,kobe bryant shoes,kobe sneakers,nike basketball shoes,running shoes,mens sport shoes,nike shoes
michael kors outlet uk
ralph lauren pas cher
louis vuitton outlet
ferragamo outlet
swarovski crystal
omega outlet
coach outlet online
polo ralph lauren outlet
kate spade handbags
coach outlet store
michael kors outlet
michael kors handbags
gucci sunglasses
rolex watches
mont blanc pens
celine outlet online
nike huarache
tiffany and co
oakley sunglasses wholesale
ghd uk
swarovski crystal
adidas gazelle
ReplyDeleteprada handbags
cheap ray ban sunglasses
ugg boots
ugg sale
polo ralph lauren outlet
nike air max 90
lebron james shoes 2016
white converse
burberry outlet canada
adidas superstars
converse sale
bottega veneta sale
nike free flyknit 3.0
louis vuitton outlet online
micahel kors
air max 90 white
sac longchamp pliage
jimmy choo outlet store
designer handbags wholesale
rolex daytona
moncler outlet online
lacoste shoes
canada goose sale
nike roshe run
louboutin shoes
hollister clothing store
canada goose outlet
yeezy boost
air max
oakley sunglasses wholesale
louboutin pas cher
michael kors outlet clearance
20160723caiyan
pandora
ReplyDeletepolo outlet
ugg outlet
michael kors outlet
red bottoms
oakley sunglasses outlet
nmd adidas
pandora jewelry
michael kors outlet
fit flops
20161021caiyan
christian louboutin
ReplyDeleteralph lauren outlet
michael kors handbags
polo ralph lauren outlet online
polo ralph lauren
ralph lauren outlet
longchamp
coach factory outlet
true religion
ray bans
20161117caiyan