Edit: I misread the question slightly - I've added "Sti" as a prefix for the generated numbers, and started at 1
You may be able to do this in a 3 step process as described in this answer. I'm assuming that you have an ID primary key field in the KMS_VEJMIDT_BRUDT
table.
Step 1:
Make a SELECT
query named GENERATE_NEXT_NAVN
using the following SQL:
SELECT C.ID, "Sti"&[RowNo] AS NEXT_VEJNAVN
FROM (SELECT A.ID,
A.VEJMTYPE,
(select count(*) from KMS_VEJMIDT_BRUDT as B where A.ID>=B.ID AND B.VEJNAVN Is Null and A.VEJMTYPE = "Sti" ) AS RowNo
FROM KMS_VEJMIDT_BRUDT AS A
WHERE A.VEJNAVN Is Null
and A.VEJMTYPE = "Sti"
) AS C;
Note the use of a Row Number workaround as described in this answer. I use this to generate an incrementing number starting from the highest NAVN present in the source table.
Step 2:
Copy the query output from Step 1 into a temporary table:
SELECT GENERATE_NEXT_NAVN.*
INTO NEXT_NAVN_TEMP
FROM GENERATE_NEXT_NAVN;
Step 3:
Update the source table using the values in the temp table:
UPDATE KMS_VEJMIDT_BRUDT
INNER JOIN NEXT_NAVN_TEMP
ON KMS_VEJMIDT_BRUDT.ID = NEXT_NAVN_TEMP.ID
SET KMS_VEJMIDT_BRUDT.VEJNAVN = [NEXT_NAVN_TEMP].[NEXT_VEJNAVN];