• Knut Boehnert - Friday, September 14, 2018 7:32 AM

    This is procedural code instead of set-based code. This will work.

    What I mean with this statement is you think in terms of single rows (cursor) instead of a data set of tables (temporary table of statements to execute).
    If you do more database "stuff" feel free to learn the difference. Jeff's articles related to RBAR (also on this site) are the best start. There are others (just want to mention out of this pool the team around Brent Ozar).

    Good for you to have worked it out yourself.

    Hai Knut,
    I did want to make a prrocedural code and this SP will work at my production servers in future..
    One minus thing at my insert syntax,,the empty tables cant include in there..i still figure it out..
    Perhaps any other suggestions i welcome..

    Thank you..