如何返回HSQL中最后插入的(自动递增的)行ID? [英] how to return last inserted (auto incremented) row id in HSQL?

查看:117
本文介绍了如何返回HSQL中最后插入的(自动递增的)行ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用HSQL数据库进行测试.我想要独立的db文件. 但是现在我很难在HSQL中获取最后插入的行ID(自动增量-身份).我怎么获得身份证?

i am working with HSQL database for testing purpose. i want standalone db file. but now i am in trouble to get last inserted row id (auto-incremental - identity) in HSQL. how can i get id??

推荐答案

当您没有给出表模式时,很难编写一个查询来执行此操作,但是类似以下内容:

It's pretty hard to write a query to perform this when you haven't given your table schema, but something like the following:

SELECT TOP 1 Id FROM [TABLENAME] ORDER BY Id DESC

这篇关于如何返回HSQL中最后插入的(自动递增的)行ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆