Microsoft SQL Server 2008 R2 Unleashed- P178

Microsoft SQL Server 2008 R2 Unleashed- P178:SQL Server 2005 provided a number of significant new features and enhancements over what was available in SQL Server 2000. This is not too surprising considering there was a five-year gap between these major SQL Server 2008 is not as much of a quantum leap forward from SQL Server 2005 | 1724 CHAPTER 43 Transact-SQL Programming Guidelines Tips and Tricks The following example is similar to the query in Listing but replaces CROSS APPLY with the OUTER APPLY clause select stor_name from stores st outer apply 3 as s where MI and in Barnes Noble B Dalton Bookseller Waldenbooks order by stor_id DESC go stor_id stor_name ord_date qty B251 B Dalton Bookseller 2008-01-23 00 00 1740 B251 B Dalton Bookseller 2007-11-04 00 00 1704 B251 B Dalton Bookseller 2008-02-22 00 00 1560 B510 Barnes Noble 2008-08-13 00 00 1464 B510 Barnes Noble 2007-10-08 00 00 1200 B510 Barnes Noble 2006-01-08 00 00 924 B511 Barnes Noble NULL NULL P963 Waldenbooks 2008-07-07 00 00 1668 P963 Waldenbooks 2006-12-30 00 00 1068 P963 Waldenbooks 2006-03-29 00 00 1032 Q017 Waldenbooks 2007-11-02 00 00 1776 Q017 Waldenbooks 2006-06-15 00 00 1704 Q017 Waldenbooks 2007-02-24 00 00 1548 Logic for Error Handling SQL Server 2005 also introduced the construct which you can use within T-SQL code to provide a more graceful mechanism for exception handling than was available in previous versions of SQL Server. In versions prior to 2005 error handling was typically done by checking @@ERROR after each SQL statement and often using the GOTO statement to branch to an error-handling routine. A construct consists of two parts a TRY block and CATCH block. When an error condition is detected in a T-SQL statement that is inside a TRY block control is immediately passed to the CATCH block where the error is processed. T-SQL statements in the TRY block that follow the statement that generated the error are not executed. If an error occurs and processing is passed to the CATCH block after the statements in the CATCH block are executed control is transferred to the first T-SQL statement that follows the END .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã 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.