===========================================================
ClassMethod MaxID(TableName as %String) As %String [ SqlProc ]
{
s lastID="0"
lock +(^lastID)
//s cmd1="s ^lastID=^Sample.PersonD"
s cmd1="s ^lastID=^"_TableName_"D"
XECUTE cmd1
s lastID=^lastID
lock -(^lastID)
q lastID
}
===========================================================
In SQL you can access it by using following SQL statement
===========================================================
Select top 1 Sample.Person_MaxID('Sample.Person') AS MaxID from Sample.Person
===========================================================
Superbbbb....
ReplyDeleteI m looking for that solution from almost a year.
thanks