We have an integration of PowerApps with Azure SQL. The inputs provided by user is stored in Azure SQL with incremental row ID. The request ID increment operation is handled in the stored procedure. But if multiple users are adding the content at same time then all requests are saved with the same Request ID. We can not force the Request ID column to be unique due to dependency.
Please suggest if we can avoid duplicates here. Here is the SP:
SELECT @ROWNUM = MAX(R.ROWNUM) + 1
FROM REQUESTS R
WHERE R.ABC = @XYZ
IF @ROWNUM is NULL
begin
set @ROWNUM = 1
end
-- Inserting a single new request into request table with auto generated identify
INSERT INTO REQUESTS
(
Column1,
……
Columnn
)
Thanks!