Скрипт 05_data_update_before_setup
-- РЕГИЗ. Причина аннулирования (1.2.643.2.69.1.1.1.60)
update dicinfodet as dt
set dt.mainrefid = -32
where dt.secondrefid = (select r.refid from refdic as r where r.refcode = '1.2.643.2.69.1.1.1.60')
and dt.mainrefid is null
and exists(select dicid from dicinfo as d where d.refid = -32 and d.dicid = dt.maindicid);
-- РЕГИЗ. Вид медицинской помощи (1.2.643.2.69.1.1.1.52)
delete from refdicdet
where refid = (select refid from refdic where refcode = '1.2.643.2.69.1.1.1.52')
and columnname = 'ext_name';
-- РЕГИЗ. Вид медицинской помощи (1.2.643.2.69.1.1.1.52)
update dicinfodet as dt
set dt.mainrefid = -10002
where dt.secondrefid = (select r.refid from refdic as r where r.refcode = '1.2.643.2.69.1.1.1.52')
and dt.mainrefid is null
and exists(select dicid from dicinfo as d where d.refid = -10002 and d.dicid = dt.maindicid);
sqlБыла ли статья полезна?