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.
Author |
Topic |
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2007-05-14 : 03:05:02
|
Dear Folks,I've two tables,(table014,table015)column01 of table014 is a primary key, and column04 is the foriegnkey.column02 of table015 is also foriegn key.how can i update column01 of table014?actually I've done this through enterprise manager, by disabling the enforcement of constraints.how can i do this by using query? and what is the correct way of doing this?thank you verymuchVinodEven you learn 1%, Learn it with 100% confidence. |
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2007-05-14 : 04:36:52
|
Friends,I"m sorry, if i didn't provide proper information for you.the column01 of table014 is a primary key , column004 of table014 and column02 of table015 are the foriegn keys. please tell me the correct way how can i update column01 of table014?VinodEven you learn 1%, Learn it with 100% confidence. |
|
|
LoztInSpace
Aged Yak Warrior
940 Posts |
Posted - 2007-05-14 : 04:43:54
|
You should not update primary keys. Arguably immutability is one of the primary things about them.You should begin transactionadd a dummy row to table014 with your new PKupdate column 2 of 15 to new PKupdate column 4 of 14 to new PKdelete using original PK from 14commit.And then go through your data model and fix it up so it has proper primary keys and proper table/column names. |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-05-14 : 05:11:01
|
"table014 table015"Scary table names ...... Table1 and Table2 I could have believed were "example names", 014 and 015 don't sound like examples though ...Kristen |
|
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2007-05-15 : 02:22:03
|
no no kiristen there are code names for our team, for each module, the suffix and prefix will change. we are very clear with thisVinodEven you learn 1%, Learn it with 100% confidence. |
|
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2007-05-15 : 05:09:02
|
quote: Originally posted by LoztInSpace You should not update primary keys. Arguably immutability is one of the primary things about them.You should begin transactionadd a dummy row to table014 with your new PKupdate column 2 of 15 to new PKupdate column 4 of 14 to new PKdelete using original PK from 14commit.And then go through your data model and fix it up so it has proper primary keys and proper table/column names.
I didn't get you. how can i take another primary key?VinodEven you learn 1%, Learn it with 100% confidence. |
|
|
|
|
|
|
|