tailieunhanh - beginning microsofl sql server 2008 programming phần 4

Nếu bạn muốn loại bỏ hoàn toàn một quy tắc từ cơ sở dữ liệu của bạn, bạn sử dụng DROP cú pháp tương tự mà chúng tôi đã trở nên quen thuộc cho các bảng:Nếu chúng ta đề cập đến "mặc định," sau đó chúng tôi đề cập đến một trong hai mặc định dựa trên đối tượng | Chapter 6 Constraints Dropping Rules If you want to completely eliminate a rule from your database you use the same DROP syntax that we ve already become familiar with for tables DROP RULE rule name Defaults Defaults are even more similar to their cousin a default constraint than a rule is to a CHECK constraint. Indeed they work identically with the only real differences being in the way that they are attached to a table and the default s the object not the constraint support for a user-defined data type. The concept of defaults vs. DEFAULT constraints is wildly difficult for a lot of people to grasp. After all they have almost the same name. If we refer to default then we are referring to either the object-based default what we re talking about in this section or a shorthand to the actual default value that will be supplied if we don t provide an explicit value . If we refer to a DEFAULT constraint then we are talking about the non-object-based solution the solution that is an integral part of the table definition. The syntax for defining a default works much as it did for a rule CREATE DEFAULT default name AS default value Therefore to define a default of zero for our Salary CREATE DEFAULT SalaryDefault AS 0 Again a default is worthless without being bound to something. To bind it we make use of sp_bindefault which is other than the procedure name identical in syntax to the sp_bindrule procedure EXEC sp_bindefault SalaryDefault To unbind the default from the table we use sp_unbindefault EXEC sp_unbindefault Keep in mind that the futureonly_flag also applies to this stored procedure it is just not used here. Dropping Defaults If you want to completely eliminate a default from your database you use the same DROP syntax that we ve already become familiar with for tables and rules DROP DEFAULT default name 182 Chapter 6 Constraints Determining Which Tables and Data Types Use a Given Rule or Default If you ever go to delete or alter .

TÀI LIỆU MỚI ĐĂNG
6    127    0    22-11-2024