Skip to content
Advertisement

Tag: sql-server

Incorrect syntax near the keyword ‘with’…previous statement must be terminated with a semicolon

Im using SQL Server 2005 . I have 2 WITH Clauses in my stored procedure But the error occurs 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. What are my options? Is there any splitter I don’t know about? Answer Use

How do I ‘subtract’ sql tables?

Its not really a subtraction I’m looking for. And I know its not a union or intersection… I have been given a long and complex stored procedure that returns a table of active and inactive documents. I have also been given a similar stored procedure that returns another table that contains only the active documents. How could I get a

How do I calculate a running total in SQL without using a cursor?

I’m leaving out all the cursor setup and the SELECT from the temp table for brevity. Basically, this code computes a running balance for all transactions per transaction. Inspired by this code from an answer to another question, I was wondering if SQL had the ability to sum numbers in the same way it’s concatonating strings, if you get my

Advertisement