在不同数据库环境下读取前N条记录
在不同数据库环境下读取前N条记录数:
1. Oracle
Select * FROM TABLE1 Where ROWNUM<=n
2. Informix
Select FIRST n * FROM TABLE1
3. MySQL
Select * FROM TABLE1 LIMIT n
4. DB2
Select * ROW_NUMBER() OVER(ORDER BY COL1 DESC) AS ROWNUM Where ROWNUM<=n
5.SQL Server
Select TOP n * FROM TABLE1
or
SET ROWCOUNT n Select * FROM TABLE1
6. Sybase
SET ROWCOUNT n Select * FROM TABLE1
7. ACCESS
Select TOP n * FROM TABLE1