I believe that friends who have done database programming have used the stored procedure. The stored procedure is most unhappy, that is, there is no definition of array, only a collection. When you want to use an array as an incubation or ginseng, it will be quite average, and the processing of the array is not as simple as in the programming environment.
In addition, it is very troublesome when you are more complicated. For example, there is an railway database, which is Table Station (stationID, stationname, station (stationid, stationorder, stationid), we want to calculate the route between the secondary station, just find the stationID according to the stationname entered, then according to STATIONID Look for a shortest path. When there is a straight reachable line in the two stations, a SQL statement can be completed, but what you need to transfer? How to get all the path, then find a shortest?
There are two ways:
1. You can handle each case through the vernal, and finally compare, but the speed of the cursor is slower than the turtle;
2. Define some functions, build some temporary tables, write a few of the way to the metamorphosis SQL statement, this method is really good, but it is difficult to maintain.
In fact, there is also a third, and a very common method - uses a normal stored procedure to read a data set at once with two stationname, and then write algorithms in a way hand, such as C #. But this means that different databases may be written in the main program, so that there is no unified interface, and the increase or decrease service cannot be as desired.
I think the extension stored procedure has solved these problems described above - a universal interface can be provided while writing fast algorithms based on CRT and .NET class libraries.
The next section and the subsequent body part will establish an example extension stored procedure, with the extended stored procedure written when I have compiled a program. To test this example, first confirm that Microsoft SQL Server 2000 and Microsoft Visual C . Net 2003 are installed.
Welcome everyone to criticize and hurt, please tell me that I am lacking, I will learn more, thank you!
Another: I have the same programming thing just to find help when I use it, I rarely understand its background. So I want to know friends who extend the work of stored procedures, see the MSDN's Extended Stored Procedure section.
This article is based on MicroSFT SQL Server 2000 Personal Edition and Microsoft Visual Studio .NET 2003.