select 'insert into mtx_system_module(module_id,module_code,module_name,module_note,create_date,version)values('
+cast(moduleid as varchar(10))+','''+ObjectID+''','''+Name+''','''+isnull(Note,'')+''',NOW(),1);' from AppModules where subsystem=1 and ParentModuleID is not null -----------------------------------------------select 'insert into mtx_app_module(module_id,parent_module_id,version)values('+cast(moduleid as varchar(10))+','+case ParentModuleID when 1 then 'NULL' else cast(ParentModuleID as varchar(10)) end+',1);' from AppModules where subsystem=1 and ParentModuleID is not null ---- select * from AppModules where subsystem=1 and ParentModuleID is not null