使用SQL Server 2000開發版,爲什麼會這樣的代碼:SQL Server 2000的 「選擇被打破」 與TOP子句
select top 10 * from table
導致此錯誤:
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '10'.
與此代碼:
select * from master m
left join locality l on m.localityid = l.localityid
導致此錯誤:
Server: Msg 170, Level 15, State 1, Line 2 Line 2: Incorrect syntax near 'left'.
您是否收到來自SSMS的錯誤?在不包含其他查詢的新窗口中? – Andomar 2009-10-21 09:09:27
該死的,這裏的下注很快。我試圖用ORDER BY建議TOP 10。它很快就被降低了。我只會在評論中發表我的回答。把一個ORDER BY放在你的TOP 10上,把沒有ORDER BY的TOP 10有一個不確定的結果,沒有多大意義 – 2009-10-21 09:12:41
so ..強烈建議爲TOP操作添加ORDER BY,即使ORDERBY-less TOP會吐出結果。 – 2009-10-21 09:15:28