create proc ujo_lic_check
@insert int,
@curr_machine varchar(80),
@curr_joid int
AS
declare @this_machine int
declare @total_machines int
if @insert = 1
begin
insert ujo_lic_machine(machine, first_stamp, first_joid, recent_stamp, recent_joid)
values(@curr_machine, getdate(), @curr_joid, getdate(), @curr_joid)
end
else
begin
update ujo_lic_machine
set
recent_stamp = getdate(),
recent_joid = @curr_joid
where
machine = @curr_machine
end
select @this_machine = count(*) from ujo_lic_machine where machine = @curr_machine
select @total_machines = count(*) from ujo_lic_machine
select @this_machine, @total_machines
GO
GRANT EXECUTE ON [dbo].[ujo_lic_check] TO [ujoadmin]
GO