Depends on what you are doing, if you can benefit from a cached optimization
plan then you might use an SP. Also, if you are going to be reusing this
code it might be better to do in an SP so you don't have to correct multiple
places instead of one. SP's are not always the answer as a bad optimization
plan will hurt you more than recompiling or having no cached optimization
plan. You can always create a stored proc with the "with recompile" feature
to not retain a cached plan
HTH
--
Ray Higdon MCSE, MCDBA, CCNA
---
"Just ask for your opinion on executing SP from SQL task"
<anonymous (AT) discussions (DOT) microsoft.com> wrote
Quote:
Which one is best practice?
To use a Execute SQL Task to called a Stored Procedure? OR
Write the sql code in the Execute SQL Task itself?
Thanks in advance for your help. Olivia |