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 |
|
mary_itohan
Posting Yak Master
191 Posts |
Posted - 2008-10-02 : 14:33:03
|
| Hello,am wondering which executes faster and is more efficient ?A function or a SP ?I have a billing script being called to execute a split function, which processes millions of csv files.These Numbers are extracted from a log file and the calling function or SP has to run a loop through these numbers and pass them to another table based on billing and logging.these are all done via a job on our database.My question is thus: Is it better to implement this as a function or stored procedure ?Thanks_____________________Yes O ! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-02 : 14:40:03
|
| implementing this as a function enhances reusability as table valued functions can be used in select statements and joins just like tables. If you're doing this as procedure you need to anyway dump results to te,p table before using in select list and joins. in that way function is better. |
 |
|
|
mary_itohan
Posting Yak Master
191 Posts |
Posted - 2008-10-02 : 14:50:35
|
| ThanksSo i put all the inserts and update in the calling SP and do all execution in the scalar function ???_____________________Yes O ! |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-03 : 00:17:32
|
quote: Originally posted by mary_itohan ThanksSo i put all the inserts and update in the calling SP and do all execution in the scalar function ???_____________________Yes O !
yup. use function to split csv and do the processing part. |
 |
|
|
|
|
|