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

Thực hành tốt nhất Với mỗi bộ hồ sơ trả lại, SQL Server sẽ, theo mặc định, cũng gửi một thông điệp rõ số hàng bị ảnh hưởng hoặc trả lại. Đây không chỉ là một phiền toái, nhưng tôi đã tìm thấy trong thử nghiệm chính thức của tôi mà nó có thể làm chậm một truy vấn bằng cách lên đến 17 phần trăm tùy thuộc vào độ phức tạp của câu truy vấn. | Part IV Developing with SQL Server FIGURE 24-2 The path and scope of return methods differ among the five possible methods of returning data. Client App Best Practice With every returned record set SQL Server will by default also send a message stating the number of rows affected or returned. Not only is this a nuisance but I have found in my informal testing that it can slow a query by up to 17 percent depending on the query s complexity. Therefore get into the habit of beginning every stored procedure with the following code CREATE PROC MyProc AS SET NOCOUNT ON Summary Using stored procedures is a way to save and optimize batches. Stored procedures are compiled and stored in memory the first time they are executed. No method is faster at executing SQL commands or more popular for moving the processing close to the data. Like a batch a stored procedure can return a record set by simply executing a SELECT command. The next chapter covers user-defined functions which combine the benefits of stored procedures with the benefits of views at the cost of portability. 622 Building User-Defined Functions q a. .2 . e j ïvçv 8 Kl S V i si 1 . - ÎTv- . ïî . . vS- sM 4 v - A . .H SQL Server 2000 introduced user-defined functions UDFs and the SQL Server community was initially slow to adopt them. Nevertheless UDFs were my personal favorite new feature in SQL Server 2000 and I still use them frequently. The community discovered that UDFs can be used to embed complex T-SQL logic within a query and problems that were impossible or required cursors could now be solved with UDFs. The result is that UDFs have become a favorite tool in the toolbox of any serious SQL Server database developer. The benefits of UDFs can be easily listed UDFs can be used to embed complex logic within a query. This is huge. I ve solved several nasty problems using user-defined functions. UDFs can be used to create new functions for complex expressions. UDFs offer the benefits

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.