TAILIEUCHUNG - Enforcing Business Rules with Column Expressions

[ Team LiB ] Recipe Enforcing Business Rules with Column Expressions Problem You need to enforce a business rule based on multiple columns in a table at the user interface tier. Solution Use expression-based columns to enforce business rules at the user interface tier. | Team LiB Recipe Enforcing Business Rules with Column Expressions Problem You need to enforce a business rule based on multiple columns in a table at the user interface tier. Solution Use expression-based columns to enforce business rules at the user interface tier. The business rule for this solution is that the sum of Fieldl and Field2 for a row in the table must be 10. The schema of table TBL0607 used in this solution is shown in Table 6-5. Table 6-5. TBL0607 schema Column name Data type Length Allow nulls Id int 4 No Fieldl nvarchar 4 No Field2 nvarchar 4 No The sample uses four stored procedures which are shown in Example 6-21 through Example 6-24 SP0607_Delete Used to delete a record from the table TBL0607 for a specified Id SP0607_Get Used to retrieve a record for a specified Id or all records from the table TBL0607 SP0607_Insert Used to insert a record into the table TBL0607 SP0607_Update Used to update a record in the table TBL0607 Example 6-21. Stored procedure SP0607_Delete CREATE PROCEDURE SP0607_Delete @Id int AS SET NOCOUNT ON delete from TBL0607 where Id @Id return 0 Example 6-22. Stored procedure SP0607_Get CREATE PROCEDURE SP0607_Get @Id int null AS SET NOCOUNT ON if @Id is not null begin select Id Field1 Field2 from TBL0607 where Id @Id return 0 end select Id Field1 Field2 from TBL0607 return 0 Example 6-23. Stored procedure SP0607_Insert CREATE PROCEDURE SP0607_Insert @Id int @Field1 int @Field2 int AS SET NOCOUNT ON insert TBL0607 Id Fieldl Field2 values @Id @Field1 @Field2 if @@rowcount 0 return 1 return 0 Example 6-24. Stored procedure SP0607_Update CREATE PROCEDURE SP0607_Update @Id int @Field1 int @Field2 int AS SET NOCOUNT ON update TBL0607 set Field1 @Field1 Field2 @Field2 .

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.