如何在SQL SERVER中实现MYSQL的一个函数功能???
在MYSQL中有一个函数: last_insert_id(),它可以得到数据表中相应列的最大值,好像只限于数值型的列,如
create table test(xh int)
insert into test
select 1
union all
select 2
union all
select 3
union all
select 6
union all
那么,
select last_insert_id(xh) from test
运行显示:
last_insert_id(xh)
1
2
3
6
再运行 select last_insert_id()
则运行显示:
last_insert_id()
6
不知道这样的函数在SQL SERVER中可否有比较简单的实现方式??