Author |
Topic |
ysut
Starting Member
6 Posts |
Posted - 2007-06-12 : 00:21:18
|
I created my own database. But I CANNOT RUN SELECT TOP 10 * FROM <tablename> in the database.But, if I try to Northwind database, I successfully run the script. Anyone from you can explain why ?I am using Ms. SQL Server 7.0Thank youYSUT |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-06-12 : 00:22:03
|
Do you get any error? What is the error description?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
ysut
Starting Member
6 Posts |
Posted - 2007-06-12 : 00:23:49
|
Error like below :Server: Msg 170, Level 15, State 1, Line 1Line 1: Incorrect syntax near '10'.The syntax is : SELECT TOP 10 * FROM <tablename>ThanksYSUT |
|
|
elwoos
Master Smack Fu Yak Hacker
2052 Posts |
Posted - 2007-06-12 : 02:55:47
|
You need an Order By otherwise there is nothing to determine the TOP bysteve-----------Don't worry head. The computer will do all the thinking from now on. |
|
|
ysut
Starting Member
6 Posts |
Posted - 2007-06-12 : 03:46:00
|
I Did.This is the full syntax. But I still got the same errorselect TOP 10 * FROM m_teknisi ORDER BY kd_teknisiAll the tables cannot be execute with SELECT TOP syntax in my own database. |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-06-12 : 08:55:28
|
Check the compatibility mode of your database. I guess it is set to 6.5.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-06-12 : 09:06:02
|
quote: Originally posted by elwoos You need an Order By otherwise there is nothing to determine the TOP bysteve-----------Don't worry head. The computer will do all the thinking from now on.
Order by will make sense when using TOP though not neccessary to useMadhivananFailing to plan is Planning to fail |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-06-12 : 12:18:52
|
It works on sql2k and later only. |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-06-12 : 12:25:41
|
I believe TOP operator was introduced in 7.0.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-06-12 : 12:36:09
|
You are right. Is the db in 70 compatibility level? |
|
|
ysut
Starting Member
6 Posts |
Posted - 2007-06-12 : 19:17:42
|
I See.Thank you very much for the replies. I asked the DB administrator, and you're right that the DB is compabtile only with version 6.5, since at the first time, we started with 6.5 version, and upgrade to version 7.0 at 1 year later.Case closed, and again, thanks a lotRegardsYSUT |
|
|
|