﻿





CREATE FUNCTION [dbo].[fis_fn_useraccount_id] (
)
RETURNS varchar(5)
AS
BEGIN
  DECLARE @NewAccount varchar(5) = [dbo].[ocms_fn_generatePassword] (5,0,1,0);

  WHILE EXISTS( SELECT * FROM [dbo].[fis_useraccounts] WHERE [useraccount_id] = @NewAccount)
	BEGIN
		SET @NewAccount = [dbo].[ocms_fn_generatePassword] (5,0,1,0);
	END

  RETURN @NewAccount;
END;