View Full Version : سوال: راهنمايي ساده در مورد stored procedure
ali_kashani
دوشنبه 27 خرداد 1387, 22:52 عصر
با سلام خدمت دوستان عزيزم
من يك توضيح در مورد stored procedure مي خواستم كه به چه درد مي خوره وچه مزايايي دارد؟
razavi_university
سه شنبه 28 خرداد 1387, 01:28 صبح
این هم توضیحاتی کوتاه در مورد SP از Books Online:
A stored procedure is a precompiled executable object that contains one or more SQL statements. Stored procedures can have input and output parameters and can issue an integer return code.
Executing a stored procedure is similar to executing a prepared statement, except that the stored procedure exists as a permanently compiled object in the database. A stored procedure can also be used to hide complex SQL statements from the application.
When executing a stored procedure in a Command object, the CommandType property must be specified with the adCmdStoredProc value. With adCmdStoredProc, the corresponding SQL statement for the underlining provider is generated. For applications that use the Microsoft OLE DB Provider for ODBC (MSDASQL), ODBC escape sequences for procedure calls are generated.
There is no need to prepare a statement that calls only a stored procedure. Both stored procedures and prepared statements are methods of precompiling statements. Because a stored procedure is precompiled, preparing a stored procedure call adds overhead. The prepared statement adds a small precompiled execution plan that calls the stored procedure execution plan, rather than executing the stored procedure execution plan directly.
در پناه حق موفق باشید و پرتوان
لطفا اول جستجو کنید
shahroozj
سه شنبه 28 خرداد 1387, 09:15 صبح
به طوره خلاصه ميشه گفت كه stored procedure يه چيزه شبيه function تو برنامه نويسي است ( البته نه دقيقا)
براي اينكه شما يك Query را چندين بار ننويسيد مي توانيد از stored procedure استفاده كنيد
البته مزاياي ديگري هم دارد
vBulletin® v4.2.5, Copyright ©2000-1404, Jelsoft Enterprises Ltd.