It's just given me the error message:
Server: Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near '('.
Line three is, of course, a comment. The full script is over fifteen hundred lines long, and has a lot of parenthisies in it. How am I supposed to work out what's wrong?
Posted to Software development by Simon Brunning at November 17, 2004 10:05 AMThree or four pints of Hoegarden will loosen up those SQL glands and the answer will simply appear to you.
Posted by: Steve on November 17, 2004 10:59 AMBinary chop is your friend :-)
Posted by: Mark Russell on November 17, 2004 01:04 PMJust to add oil to the fire, I've had a couple of times where I got that message and didn't have ANY perenthisis in the query.
This might help:
Stick the query in a text editor and add PLENTY of carrage returns like,
SELECT *
FROM table
INNER Join table2
ON table1.id=table2.id
WHERE table1....
AND table2...
ORDER BY table1.id ASC,
and try the query again. You should get a line reference thats a bit closer to the error.
Possibly.
Yeah, binary chop was the answer. I commented half the script out, which told me that the error was in the first half of the script. So I commented out half of *that*, and so on and so forth.
Bloody SQL server.
Posted by: Simon Brunning on November 17, 2004 01:24 PMCan I just say that it serves you right for having a 1500 line SQL Server script?
I just hope it doesn't have any T-SQL in it, because then you are headed straight for the sevcnth level of the inferno. See http://www.halfcooked.com/mt/archives/000384.html
Posted by: Andy Todd on November 17, 2004 09:49 PMOh no - it's utterly standard ANSI SQL. It would (I think) run unaltered on a '400.
I don't know any T-SQL, and I don't intend to learn any.
I did originally have a bunch of separate scripts, but running ten scripts, one after the other, time after time was getting irritating. I'm sure there's a compromise, but not knowing SQL Server, I don't know what it is.
Posted by: Simon Brunning on November 18, 2004 08:42 AM