Dynamic vs. Stored Procedure table inserts

6,360 pts.
Tags:
SQL 2000
SQL Server
VB .NET

I just finished making some code changes to get around a problem. I changed my code from doing a dynamic insert to using a stored procedure. Originally it was 20 lines of code for the dynamic process. Doing it the stored procedure way, by the time you defined all the parms it was 107 lines of vb code and 70 lines in the stored procedure.

Looking for the pros and cons and your personal preference over one method or the other.



Software/Hardware used:
sql server 2000
ASKED: September 20, 2013  1:47 PM
UPDATED: September 20, 2013  2:40 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    We usually try to keep things as simple as possible.  If doing it with stored procedures makes the code easier to read/understand and easier to maintain, then we wouldn't mind having to write some more code, but if doing it dynamically is simple enough and the security risks that could be added by using dynamic SQL are not present in this specific case (that would depend on where the data is coming from and what you have done to sanitize it before building the dynamic code), I would continue doing it dynamically.
    65,110 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following