DECLARE @LastIdentity BIGINT; SET @LastIdentity = SCOPE_IDENTITY();
Internally VistaDB maps this function to @@IDENTITY which will return values in scenarios where SCOPE_IDENTITY would not.