I have this stored procedure which is simply collecting lots of information so there isn't really anything I could name it to explain. Would it be best to ask a question with stored procedure code in it asking for reviews?

Here is the code but that's for some modifications I need to make to it.

  • 1
    \$\begingroup\$ I don't see why a sp wouldn't be okay. Does it work as intended? Can you provide enough info on the Db schema for the so to make sense? \$\endgroup\$
    – nhgrif
    Apr 24, 2015 at 11:15
  • \$\begingroup\$ As its using lots of tables and functions, is it necessary to provide all of them and there explanation or just the SP code would do it, it may take few hundred lines to add them all, which is the reason of this question, should had added it to my post - sorry \$\endgroup\$ Apr 24, 2015 at 11:21
  • \$\begingroup\$ Yes, it works as intended without any bugs though \$\endgroup\$ Apr 24, 2015 at 11:21
  • \$\begingroup\$ See rolfl's answer. As for the schema, it may be okay without it, but it tends to make questions about SQL harder to answer, and not including it makes your question at risk of being "unclear" (but not a guaranteed closure) \$\endgroup\$
    – nhgrif
    Apr 24, 2015 at 11:24

1 Answer 1


In general, if your code is not (yet) doing what you need it to do, then it is "not working code" with respect to Code Review. On Code Review, we require "working" code - code which not only runs, code which not only produces results, but also it has to produce the results you want. If your question is about making existing code do something new, or different, or to add a new feature, then it is not ready for a Code Review, and is thus off-topic here.

Your actual question is:

I need to adjust this @Compare in outer APPLY, so I get it for each line. However I don't want my result to change other then getting another column @Compare.

Once you have the code doing what you want it to do, then you should feel free to bring it here for review, and we can help accomplish the same results, but better ;-)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .