Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
naveenbalraj
Starting Member
18 Posts |
Posted - 2009-07-01 : 23:23:18
|
| Hi,I have this table with 40 fields and I'm to write a stored procedure to retrieve around 30 fields based on the id passed (it can be one or more than one records).I have 5 different sections, that will use the result set.My question, is it advisable to write one stored procedure to get all the 30, or can i write 5 stored procedures for each section.What are the pros and cons of using one single stored procedure and 5 stored procedures based on the section need (though the information is from the same table).Thanks for any information.-Naveen |
|
|
malaytech2008
Yak Posting Veteran
95 Posts |
Posted - 2009-07-02 : 00:58:49
|
| You use one SP instead of five SP. Because when you are using five SP then there will be performance overhead and at the same time it will become complicated.ThanksMalay |
 |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-07-02 : 05:14:44
|
| Hisingle procedure is fine what malay said.Procedure we can able to control the flow. so you can control your sections in procedure.byraj...:) |
 |
|
|
rohitkumar
Constraint Violating Yak Guru
472 Posts |
Posted - 2009-07-02 : 07:58:35
|
quote: Because when you are using five SP then there will be performance overhead
what kind of performance overhead? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-07-02 : 11:12:07
|
quote: Originally posted by naveenbalraj Hi,I have this table with 40 fields and I'm to write a stored procedure to retrieve around 30 fields based on the id passed (it can be one or more than one records).I have 5 different sections, that will use the result set.My question, is it advisable to write one stored procedure to get all the 30, or can i write 5 stored procedures for each section.What are the pros and cons of using one single stored procedure and 5 stored procedures based on the section need (though the information is from the same table).Thanks for any information.-Naveen
why cant you rewrite them into single procedure giving all sections...may be based on parameter. |
 |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2009-07-02 : 11:53:24
|
| You could run some peformance tests. But, one call to the database should be more performant than five calls to get the same data. |
 |
|
|
|
|
|