Sql server 在文本框中显示当前最大列值之后的值

Sql server 在文本框中显示当前最大列值之后的值,sql-server,vb.net,Sql Server,Vb.net,我想显示表格最后一行的旁边 编辑:忘记ctr_no不是整数 select ctr_no from request_table where req_no = (select max(req_no) from request_table); 使用未经测试的子查询;要求2012年或更高版本: select top 1 'ctr_' + convert(try_parse(substring(ctr_no,3,4) as int) as nvarchar(7)) from request_table

我想显示表格最后一行的旁边

编辑:忘记ctr_no不是整数

select ctr_no from request_table where req_no = (select max(req_no) from request_table);

使用未经测试的子查询;要求2012年或更高版本:

select top 1 'ctr_' + convert(try_parse(substring(ctr_no,3,4) as int) as nvarchar(7)) from request_table where req_no = (select max(req_no) from request_table);

你是说倒数第二列?倒数第二行没有意义在倒数第二列之后,@NoDisplayName,即使该列是自动递增的?可能应该将倒数第二行更改为当前最大列值之后的值,或者在这两个位置都类似。输出为“ctr0002”,我将尝试修改您的查询,希望得到答案。多谢了,我的代码做的正是我所想的;不利的是,这并不是你真正想要的。希望能解决。