08/17/2023
06:16 PM
- last edited on
08/17/2023
11:03 PM
by
Sunil
Hi Team,
We have a requirement to Auto-increment AccountName in a particular sequence.
For that we need to check whether that Account Name present already or not and then generate it.
currently using below query:
select cast(max(AccountNames.AN)+1 as UNSIGNED) from (select max(ACCOUNTNAME) as AN from arstasks where ENDPOINT=66 and ACCOUNTNAME like '81%' Union select max(NAME) as AN from accounts where ENDPOINTKEY=66 and NAME like '81%') AccountNames
which checking Accounts table and Arstasks table and generating Account number with next number.
But if the request is in progress then Task or Account not created. So no entry will be accounts or arstasks table. So if again a new Request created then auto-increment not working.
Can't find where exactly AccountName stored in ARS tables. Checked in ars_request and request_access tables it not there.
Can anyone help how to get accountName value from ARS tables?
[This message has been edited by moderator to mask username]
Solved! Go to Solution.
08/17/2023 10:29 PM
Hi @soumyabrata
The account names of the request are stored in the request_access_attrs table. Please see the sample query below. Modify is as per your request.
select attribute_value from request_access_attrs where request_access_key in (select request_accesskey from request_access where requestkey=<requestkey>) and attribute_name='ACCOUNTNAME'
Replace the <requestkey> in the above query to fetch the data for a specific request. Hope this helps!