TAILIEUCHUNG - Hướng dẫn học Microsoft SQL Server 2008 part 70

Việc kích hoạt giao dịch hàng tồn kho Việc kích hoạt kiểm kê giao dịch thực hiện chức năng tổng hợp của việc duy trì giá trị quantityon tay hiện trong bảng tồn kho. | Part IV Developing with SQL Server The OBXKites database includes a simplified inventory system. To demonstrate transaction-aggregation handling the following triggers implement the required rules. The first script creates a sample valid inventory item for test purposes USE OBXKites DECLARE @ProdID UniqueIdentifier @LocationID Uniqueldentifier SELECT @ProdID ProductID FROM WHERE Code 1001 SELECT @LocationID LocationlD FROM WHERE LocationCode CH INSERT ProductID InventoryCode LocationlD VALUES @ProdID A1 @LocationID SELECT FROM AS I INNER JOIN AS P ON Result Code InventoryCode QuantityOnHand 1001 A1 0 The inventory-transaction trigger The inventory-transaction trigger performs the aggregate function of maintaining the current quantity-on-hand value in the Inventory table. With each row inserted into the InventoryTransaction table the trigger updates the Inventory table. The JOIN between the Inserted image table and the Inventory table enables the trigger to handle multiple-row inserts CREATE TRIGGER InvTrans_Aggregate ON AFTER Insert AS UPDATE SET QuantityOnHand FROM AS Inv INNER JOIN Inserted AS i ON Return 652 Creating DML Triggers 26 The next batch tests the InvTrans_Aggregate trigger by inserting a transaction and observing the InventoryTransaction and Inventory tables INSERT InventoryTransaction InventorylD Value SELECT InventoryID 5 FROM WHERE InventoryCode A1 INSERT InventoryTransaction InventoryID Value SELECT InventoryID -3 FROM WHERE InventoryCode A1 INSERT InventoryTransaction InventoryID Value SELECT InventoryID 7 FROM WHERE InventoryCode A1 The following query views the data within the InventoryTransaction table SELECT FROM AS

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.