Need Help on writing SP

  • Hi I am novice in SQL development and want help on writing a procedure. My requirement is first I will get some data through a query and then for each record from the result  need to run another query. Now for each record from that result set have to run a procedure. I am using CTE to get the result in first case but unable to proceed further.
    Please help me in writing the logic. Thanks for your help.


          

  • Hi,
    please post your t-sql code  you  create until now.
    And show us the create script of the tables you use.

    With this kind of discription, no one could help you.

    Best regards,

    Andreas

  • KGNH - Wednesday, April 25, 2018 11:08 PM

    Hi I am novice in SQL development and want help on writing a procedure. My requirement is first I will get some data through a query and then for each record from the result  need to run another query. Now for each record from that result set have to run a procedure. I am using CTE to get the result in first case but unable to proceed further.
    Please help me in writing the logic. Thanks for your help.


          

    To complete that process, you need to learn dynamic sql. That's something that I would advice a novice to do as it can be dangerous. Dynamic SQL is basically like a scalpel, it can be great in the right hands but it can kill someone in the wrong ones.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

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

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