Feed on
Subscription

Technology of SQL Server database (87)




A few are in in front,We introduced how to state in detail cursor,Read access to occupy from inside cursor and shut, the method that releases cursor.We will give out below example of a few application makes the reader has more comprehensive knowledge to cursor.

The application of variable of 13.7.1 cursor
We had mentioned cursor is the new variable type that just begins to use from version of MS SQL SERVER 7,Cursor often is in to store by application in process, trigger.So cursor is how be regarded as variable and apply?The text version of SQL statement that watchs systematic process Sp_cursor_list,Can have results greatly.


In this memory process,@cursor_return is one cursor variable,The person that return its result part its to call,Each attribute that this result collect stores current and all cursor is worth.
Clew:In memory process,If be defined to be the option of variable use OUTPUT of cursor type,Must use VARYING key word,It is form of @variable CURSOR VARYING OUTPUT namely.
Exemple 13-9:If prepare to be in client computer program,handle to retrieving the data that give to undertake from database server,The memory procedure that can establish to include cursor so.
Delete Jobs_cursor of homonymic memory process above all

Found memory process Jobs_cursor then




Cursor of 13.7.2 nest
To handle result volume neatly,Can use in memory process multilayer cursor.
Exemple 13-10:This exemple established the memory course that includes two cursor.Ground floor cursor deposits the data logging that process parameter accords with in Authors watch,Read from inside ground floor cursor every time take data of an Authors,All over all previous next the second cursor,Read the news that concerns this Authors take.If prepare to make etc of a nest,This kind of method is very effective.









Related:

    收藏到网摘:

    Submit: