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 |
|
ramu143
Yak Posting Veteran
64 Posts |
Posted - 2008-05-06 : 03:24:43
|
| what is query to get top 100 rows from the table x |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-05-06 : 03:35:23
|
| SELECT Top 100 field1,field2,.. from x order by orderfieldWhere orderfield is field based on which you want top 100 rows |
 |
|
|
ramu143
Yak Posting Veteran
64 Posts |
Posted - 2008-05-06 : 03:37:04
|
| give me with example |
 |
|
|
Anoop
Starting Member
6 Posts |
Posted - 2008-05-06 : 03:57:39
|
| CREATE TABLE tbl1 (col1 int)INSERT INTO tbl1 VALUES (1)INSERT INTO tbl1 VALUES (2)INSERT INTO tbl1 VALUES (3)INSERT INTO tbl1 VALUES (4)INSERT INTO tbl1 VALUES (5)INSERT INTO tbl1 VALUES (6)SELECT TOP 3 *FROM tbl1 |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-05-08 : 06:44:27
|
quote: Originally posted by Anoop CREATE TABLE tbl1 (col1 int)INSERT INTO tbl1 VALUES (1)INSERT INTO tbl1 VALUES (2)INSERT INTO tbl1 VALUES (3)INSERT INTO tbl1 VALUES (4)INSERT INTO tbl1 VALUES (5)INSERT INTO tbl1 VALUES (6)SELECT TOP 3 *FROM tbl1
You should use ORDER BY ClauseMadhivananFailing to plan is Planning to fail |
 |
|
|
eralper
Yak Posting Veteran
66 Posts |
Posted - 2008-05-08 : 06:53:58
|
| SELECT TOP 100 * from tbl1 order by col1-------------Eralperhttp://www.kodyaz.com |
 |
|
|
|
|
|