• The first error message is giving you the solution to the problem.

    Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.

    This is a common table expression and it's a powerful tool that will help you in many scenarios. You can read more about them here[/url] and here. But feel free to explore for more information on the subject. And don't forget to ask any other specific questions you have.:-)

    EDIT: I forgot to mention that you must terminate your previous statement with a semicolon (;) and even try to terminate all of your statements with it to avoid future problems.

    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