+ Reply to Thread
Results 1 to 2 of 2

Sprocs v. embedded queries

  1. Sprocs v. embedded queries

    I've read that the advantages of sprocs over embedded queries is that the
    former are compiled once.

    Does one loose the advantages of stored procedures when one concatentates a
    lot of strings together and then uses the EXEC function to execute the
    subsequent query? I'm seeing a lot of this in the stored procedures I'm
    debugging.

    Thanks,
    Siegfried

  2. Re: Sprocs v. embedded queries

    Depending on how the dynamic queries are done they may or may not have
    reusable plans. If they are using sp_executesql instead of exec() and use
    the parameters properly they can be reused. Have a look at this:
    http://www.microsoft.com/technet/pro...05/recomp.mspx

    --
    Andrew J. Kelly SQL MVP
    Solid Quality Mentors


    "Siegfried Heintze" wrote in
    message news:FA7E8CB7-D41A-45BC-8A25-D7A286B0B1A9@microsoft.com...
    > I've read that the advantages of sprocs over embedded queries is that the
    > former are compiled once.
    >
    > Does one loose the advantages of stored procedures when one concatentates
    > a
    > lot of strings together and then uses the EXEC function to execute the
    > subsequent query? I'm seeing a lot of this in the stored procedures I'm
    > debugging.
    >
    > Thanks,
    > Siegfried



+ Reply to Thread