Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Các thủ tục được lưu trữ thứ hai là chung chung và chuyển đổi thông tin từ con trỏ vào một biến duy nhất Tab truy cập cơ sở dữ liệu kiểm soát cơ sở dữ liệu người dùng có thể truy cập và các thành viên của người sử dụng trong vai trò | 438 SQL Server 2000 Stored Procedure Programming Close curItems Deallocate curltems Return 0 Go The second stored procedure is generic and converts information from cursors into a single variable Create Procedure prProcess_Cursor_Nested -- Process information from cursor initiated in calling sp. -- Convert records into a single varchar. @chvResult varchar 8000 OUTPUT @debug int 0 As Declare @intCountProperties int @intCounter int @chvItem varchar 255 @insLenItem smallint @insLenResult smallint Fetch Next From curItems Into @chvItem While @@FETCH_STATUS 0 Begin If @debug 0 Select @chvItem Item -- check will new string fit Select @insLenItem DATALENGTH @chvItem @insLenResult DATALENGTH @chvResult If @insLenResult @insLenItem 8000 Begin Select List is too long over 8000 characters Return 1 End 440 SQL Server 2000 Stored Procedure Programming HOW TO PROCESS THE RESULTSET OF A STORED PROCEDURE From time to time you will encounter stored procedures that return resultsets you need to process. This is not as simple as it sounds. One option is to receive the resultset in a client application or middleware component and to process it further from there. Sometimes this option is not acceptable for a variety of reasons. For example the resultset might be too big and network traffic could be considerably increased in this way. Since the resultset needs to be transferred to the middleware server before it is processed the performance of the system could be degraded. There might be security implications for example if a user should have access only to a segment of a resultset and not to the complete resultset. Another option is to copy the source code of the stored procedure into your stored procedure. This could be illegal. It will also reduce the maintainability of your code since you have two copies to maintain. If the other stored procedure is a system stored procedure Microsoft can change its internals with the release of each new version of SQL Server. Your stored procedure