declare @cnt int, @id int

if OBJECT_ID('tempdb..#tmp') is not null
	drop table #tmp

select 
'1' as Code, 'неоптимальная' as [Name]
into #tmp
union all
select '2' as Code, 'затруднена' as [Name] union all
select '3' as Code, 'отсутствует акустическое окно' as [Name]

SET @cnt = 3
exec @id = [dbo].[sp_GenerateIdForEntity] @EntName = 'AKUZ.DICTIONARY_BASE', @count = @cnt 

insert into akuz.T_DICTIONARY_BASE (Code, [Name], [DateAdd], type_, DictionaryID)
select t.Code as Code
	, t.[Name] as [Name]
	, '20241029' as [DateAdd]
	, (select EntityID from vclib.T_ENTITIES where EntName = 'VISUALIZATION_QUALITY_DICTIONARY') as type_
	, (ROW_NUMBER() over(order by Code) + @id) as DictionaryID
from #tmp t

drop table #tmp