5
КонецЦикла
14.11.13
✎
02:05
|
ТекстЗапроса = "
|if exists (select * from tempdb..sysobjects where id = object_id('tempdb..#temptovpr'))
|drop table #temptovpr
|create table #temptovpr (id char(9), isfolder tinyint, flag tinyint primary key clustered (id))
|
|insert #temptovpr values (:ВыбТовар, 1, 1)
|
|while 1 = 1 begin
|
|insert into #temptovpr
|select id, isfolder, $Прайс.ВклВФСервис
|from $Справочник.Прайс_лист as Прайс (nolock)
|where parentid in (select id from #temptovpr where isfolder = 1 and flag = 1)
|and id not in (select id from #temptovpr)
|and ismark = 0
|
|if @@rowcount = 0 break
|end
|
|delete from #temptovpr where isfolder = 1
|";
RecordSet.УстановитьТекстовыйПараметр("ВыбТовар", ВыбТовар);
RecordSet.ВыполнитьИнструкцию(ТекстЗапроса);
|
|