Declare @f_menu_id numeric
Declare @f_menu_seq numeric

select @f_menu_seq = max(cf_menu_seq) + 1
From cf_menu
Where program_category = 'MBL'
and object_type = 'M'

INSERT INTO cf_menu ( language_cd, object_name, object_descs, object_type, program_category, ico_name, remarks, cf_menu_seq, audit_column, custom_flag, external_program, access_audit, mobile_object_type, audit_user, audit_date, column1, column2, column3, column4, column5 )
VALUES ('DEFAULT','m_ast_asset_audit','Asset - Asset Audit','M','MBL','(Default)',NULL,@f_menu_seq,'0','0','0','0','M','admin',getdate(),'Asset',NULL,NULL,NULL,NULL)
select TOP 1 @f_menu_id = RowID from cf_menu order by rowid desc
Insert cf_user_access (site_cd, empl_id, menuid, exe_flag, view_flag, new_flag, edit_flag, del_flag, print_flag)  Select cf_site_user.site_cd, cf_site_user.empl_id,@f_menu_id ,0 ,0 ,0 ,0 ,0 ,0 From cf_site_user 
Insert cf_menu_template_access (template_cd, menuid, exe_flag, view_flag, new_flag, edit_flag, del_flag, print_flag, audit_user, audit_date)  Select cf_menu_template.template_cd, @f_menu_id ,0 ,0 ,0 ,0 ,0 ,0 ,'admin' , GetDate() From cf_menu_template 



