在不同数据库环境下读取前N条记录数:
1. Oracle
Select * FROM TABLE1 Where ROWNUM<=N
2. Informix
Select FIRST N * FROM TABLE1 where 1=1
3. MySQL
Select * FROM TABLE1 where 1=1 LIMIT N
4. DB2
Select * ROW_NUMBER() OVER(ORDER BY COL1 DESC) AS ROWNUM Where ROWNUM<=N
或者
Select COLUMN FROM TABLE where 1=1 FETCH FIRST N ROWS ONLY
5.SQL Server
Select TOP N * FROM TABLE1 where 1=1
or
SET ROWCOUNT N Select * FROM TABLE1 where 1=1 SET ROWCOUNT N1
6. Sybase
SET ROWCOUNT N Select * FROM TABLE1 where 1=1 SET ROWCOUNT N1
7. FOXPRO
Select * TOP N FROM TABLE orDER BY COLUMN
8. access
Select TOP N * FROM TABLE1 where 1=1
新闻热点
疑难解答