Using sp_executesql hangs up!!

  • I'm dynamically creating my query and executing it with sp_executesql command. My problem is that sometimes it works perfectly, but some other it hangs up for up to 4 minutes and then finishes the execution.

    Anyone have had this problem before?? any solution you can give me?? pleaseeee

  • Seems it's locking problem.

    Check sp_who or sp_who2.

    _____________
    Code for TallyGenerator

  • Problem does not lies in sp_executesql.

    Also check your query plan and also server activity when you run the query

  • I agree the problem is probably with your query.  Since it's dynamic make sure you are properly joining your tables (if you're joining) and make sure your where clause is properly using your indexes.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply