表结构更改后或新增加数据后同步到表中

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

posted @ 2014-08-14 17:00  多远才是未来  阅读(274)  评论(0编辑  收藏  举报