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
 Syntax error

Author  Topic 

meef
Posting Yak Master

113 Posts

Posted - 2011-07-01 : 10:03:07
[code]AND force_delivered = 0
AND ((SELECT TOP 1
ISNULL(status_code, appt_status_code)
FROM tbl_214_status a
LEFT JOIN tbl_214_isa b ON b.tbl_214_id = a.tbl_214_id
ORDER BY isa_09 DESC, isa_10 DESC, status_date DESC, status_time DESC, a.record_num DESC) <> 'D1'
END[/code]

I'm getting "Syntax error near END" as an error, what am I missing at the end of the line above it? I only posted the portion of code with the error, so I'm not missing the BEGIN or other stuff.

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-07-01 : 10:09:08
You have an extra left bracket at "AND ((SELECT TOP 1".
Go to Top of Page

meef
Posting Yak Master

113 Posts

Posted - 2011-07-01 : 10:11:48
Gah, my eyes skipped right over the one at the beginning of "status_code". Thanks.
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-07-01 : 15:35:46
In SQL 2005 there used to be a feature where you can place your cursor on one bracket and press control-] which would take you to the matching bracket. I can't find it anywhere in SQL 2008.

Either I must have configured my set up accidentally to remove that feature, or Microsoft might have felt that that is too much of a convenience to have.
Go to Top of Page
   

- Advertisement -