返回插入数据库中的最新数据??? [英] Returning most recent data inserted in database???
本文介绍了返回插入数据库中的最新数据???的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道,如何返回数据库中最近插入的记录...
查询应该是什么?
实际上我正在应用程序中叠加图像...
我想显示上传的最新图像.
这就是为什么我要这个查询..
谢谢...:)
i want to know, how to return recently inserted records in the database...
what should be the query??
actualy i am uploding images in the application...
and i want to show most recent images uploaded..
that is why i am asking for this query..
thanks... :)
推荐答案
由于您使用的是SQL Server 2005,因此您也可以这样做:
Since you are using SQL Server 2005, you could also do:
SELECT TOP (@N) * FROM SomeTable ORDER BY SomeColumn DESC
另外,如果采用ROWCOUNT方式,请记住在运行查询后将其设置回0.
Also, if you go the ROWCOUNT way, remember to set it back to 0 after you run your query.
我得到了查询..
是..
设置行数N
SELECT * FROM table_name
ORDER BY column_name desc
i got the query..
it is..
SET ROWCOUNT N
SELECT * FROM table_name
ORDER BY column_name desc
这篇关于返回插入数据库中的最新数据???的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文