Data referential integrity in SQL SERVER 2005

As the straight left

Because of my work, I used SQL SERVER 2005 recently.

But setting up referential integrity between the two tables took some work. I can’t believe this is Microsoft SQL SERVER. Before, how many people used SQL SERVER because of its ease of use, foolproof operation? Maybe it’s a lot more powerful, but it doesn’t have to be completely different. At the beginning, SQL SERVER2000 is how easy to use ah.

In 2005, setting referential integrity between two tables looked like this:

1, In SQL SERVER MANAGEMENT STUDIO (enterprise Manager no longer exists), select the table to which you want to add foreign keys, right click, and choose Modify. Be careful which table you choose. If table A deletes A record and table B deletes A corresponding record, then the relationship should be set on table B. A is the primary table, B is the secondary table.

2, open the table, according to the help instructions, to find “relationship” button, no, can not find, then right click, choose “relationship” in the pop-up menu;

3, choose “standardization” tables and columns, then change magically appeared a button on the right, your can click browse (if don’t, I’m sorry, the button has been hidden, for millions of years, in a long time, quietly waiting for you to use the mouse to click on the person who looks like an edit text line, in an effort to be awakened and magically appear, I have an absolute surprise for you — oh, how romantic!

4. After selecting the associated table, go back and open the collapsed INSERT and UPDATE specification, which has child nodes: UPDATE, delete. The delete operation has four options: no operation, cascade, Set null, and set default. What do they mean? Who can tell me? Check the help, input “INSERT and UPDATE specification” is not available, input “cascade”, is also not available. The help inside is very interesting, A page said no two sentences, there is A link below, said that if you want to see more detailed help, you can click on page B, and then to page B, said two sentences, and recommended that you go back to page A, jump around, the above help is all bullshit.

There was a guy who got lost in his helicopter and hung a banner on it that said, “Where am I? Then someone in a building saw it and put up a banner that said, “You’re on a plane.” It turned out that the person in the building was Microsoft’s help documentation team.

Help does not have what help sex, seek also do not have a result on the net, have to try one by one. Finally, it is found that “cascade” in the deletion specification can achieve the data referential integrity of the two tables, that is, the records of the two tables are deleted together. If you select “Set default” at the beginning, only the foreign key values in the corresponding table are set to NULL.

Now I am not familiar with SQL SERVER2005, think it is difficult to use, how to look at how uncomfortable, too complex, SQL SERVER2000 before the advantages almost lost. The query analyzer is gone. Microsoft seems to have come to a dead end, and in everything it does, it seems to be digging its own grave.

I just feel it.