scenario:This query updates the ModuleId,SubModuleID columns in tbl1 based on PQR column by using the values from the two different tables tbl2 and tbl3 i.e. tbl2.ModuleId and tbl3.SubModuleId if PQR column has in the foramt of ModuleName\SubModuleName.
select (select ModuleID from appmodules where Modulename =
substring(permissionssection,0,charindex('\',permissionssection))) as MainModuleID,(select Max(SubModuleID) from appsubmodules where (SubModulename = substring (permissionssection
,charindex('\',permissionssection)+1,len(permissionssection))) or (Replace(SubModulename,' ','') = substring (permissionssection
,charindex('\',permissionssection)+1,len(permissionssection))) ) as SubModuleID,substring(permissionssection,0,charindex('\',permissionssection)) as start,substring (permissionssection ,charindex('\',permissionssection)+1,len(permissionssection)) as endID from securable.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment