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

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

问题描述

我正在使用 HSQL 数据库进行测试.我想要独立的数据库文件.但现在我很难在 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天全站免登陆