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.
| Author |
Topic |
|
stango
Starting Member
8 Posts |
Posted - 2003-02-24 : 12:59:32
|
| Is there some new syntax for Selecting the top "n" records from a table in 2000?I have the following query: select top 10 charter_id from charterand it keeps giving me the following error: Incorrect syntax near '10'this is the syntax from sql 7, but in the t-sql help it says to do it this way, what am I missing? |
|
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2003-02-24 : 13:03:07
|
| That looks right to me.Are there other parts to the query?Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
 |
|
|
stango
Starting Member
8 Posts |
Posted - 2003-02-24 : 13:07:26
|
| Nope, that's it. I wonder if it matters that I'm sending the query through a VNC channel (think PC AnyWhere). I seriously doubt it though, because I can run other queries using things like max and count without a problem. This is a new install of SQL 2000 on this machine, is there maybe a setting that needs to be checked?? |
 |
|
|
monkeybite
Posting Yak Master
152 Posts |
Posted - 2003-02-24 : 13:54:31
|
| Check your db compatibility level. If it's set to below 70, the SELECT TOP x syntax is invalid.EXEC sp_dbcmptlevel [put_db_name_here]-- monkey |
 |
|
|
stango
Starting Member
8 Posts |
Posted - 2003-02-24 : 14:31:24
|
| thanks monkeybite.....it was set to 65 |
 |
|
|
|
|
|