INSERT INTO catalog_category_entity (
entity_type_id, 
attribute_set_id, 
parent_id, 
created_at, 
updated_at, 
path, 
position,  
level, 
children_count
) values (
(
SELECT b.entity_type_id from eav_entity_type b
 
WHERE b.entity_table = 'catalog/category' 
)
 ,
(
SELECT b.default_attribute_set_id from eav_entity_type b
 
WHERE b.entity_table = 'catalog/category' 
)
,
<@PROCESS@>@select substring(IMP_EXTID from 6 for 12) from IMP_LINK where WGROUPID =
 <@WPARENTGROUP2ID@> and imp_sourceid =<@SOURCEID@> ##,
now(),
now(),
'1/2/<@PROCESS@>@select trim(substring(IMP_EXTID from 6 for 12)) from IMP_LINK where WGROUPID =
 <@WPARENTGROUP2ID@> and imp_sourceid =<@SOURCEID@> ##/<@PROCESS@>@select trim(substring(IMP_EXTID from 6 for 12)) 
from IMP_LINK where WGROUPID = <@WGROUPID@> and imp_sourceid =<@SOURCEID@> ##',
<@WSORTNO@>, 
'2',
'0'
)

 
