Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Tạo chức năng với các lược đồ liên kết Tất cả ba loại chức năng người dùng định nghĩa có thể được tạo ra với các lợi ích bổ sung đáng kể của lược đồ liên kết. Lượt xem có thể được lược đồ bị ràng buộc; theo cách này, giống như quan điểm UDFs - cả hai có thể được lược đồ bị ràng buộc. Đây là một trong những lý do tại sao bạn có thể chọn một UDF trong một thủ tục lưu trữ, như thủ tục lưu trữ không thể được lược đồ bị ràng buộc | Part IV Developing with SQL Server END AS status FROM sys.triggers Tr JOIN sys.objects Ob ON Tr.parent_id Ob.object_id JOIN sys.schemas Sc ON Ob.schema_id Sc.schema_id WHERE Tr.Type TR and Tr.parent_class 1 ORDER BY Sc.name . Ob.name Tr.Name Result table trigger type status HumanResources.Employee dEmployee instead of enabled Person.Person iuPerson after enabled Production.WorkOrder iWorkOrder after enabled Production.WorkOrder uWorkOrder after enabled Purchasing.PurchaseOrderDetail iPurchaseOrderDetail after enabled Purchasing.PurchaseOrderDetail uPurchaseOrderDetail after enabled Purchasing.PurchaseOrderHeader uPurchaseOrderHeader after enabled Purchasing.Vendor dVendor instead of enabled Sales.SalesOrderDetail iduSalesOrderDetail after enabled Sales.SalesOrderHeader uSalesOrderHeader after enabled Triggers and security Only users who are members of the sysadmin fixed server role or are in the dbowner or ddldmin fixed database roles or are the tables owners have permission to create alter drop enable or disable triggers. Code within the trigger is executed assuming the security permissions of the owner of the trigger s table. Working with the Transaction A DML INSERT UPDATE or DELETE statement causes a trigger to fire. It s important that the trigger has access to the changes being caused by the DML statement so that it can test the changes or handle the transaction. SQL Server provides four ways for code within the trigger to determine the effects of the DML statement. The first two methods are the update and columns_updated functions which may be used to determine which columns were potentially affected by the DML statement. The other two methods use deleted and inserted images which contain the before and after data sets. Determining the updated columns SQL Server provides two methods for detecting which columns are being updated. The first is the UPDATE function which returns true for a single column if that column is affected by the DML transaction IF UPDATE