Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Incorrect Syntax

Author  Topic 

munkdogg
Yak Posting Veteran

53 Posts

Posted - 2008-12-09 : 19:51:44
Hello all,

A vendor gave me this script to run against an application db (sql2k);

SELECT  PER, SEG0, SEG1, [ID], SG_ID, PT_ID, TOTALCOUNT
FROM ( SELECT PER, SEG0, SEG1, [ID], SG_ID, PT_ID, COUNT([ID]) AS TOTALCOUNT
                FROM D_HR_PAY
                GROUP BY PER, SEG0, SEG1, [ID], SG_ID, PT_ID
                HAVING COUNT([ID]) <> 1
                ) MULTREC
ORDER BY ID, PER, SEG0, SEG1, SG_ID, PT_ID

But it returns;

Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near ' '.
Server: Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near ' '.

For the life of me I see nothing awry. Can anyone point out where this is going wrong?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-10 : 02:16:48
I dont think erro is posted query. are you executing this as part of batch?
Go to Top of Page

munkdogg
Yak Posting Veteran

53 Posts

Posted - 2008-12-10 : 08:31:53
quote:
Originally posted by visakh16

I dont think erro is posted query. are you executing this as part of batch?



Nope, this is a single query.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2008-12-10 : 08:44:30
Then check the whole text for special characters.

You can delete all spaces and insert new spaces for example.

Webfred


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -