dbo.QER_FGIAdminUnitForPerson

SQL_SCALAR_FUNCTION

Created 2025-06-27T17:59:27.207 · modified 2026-04-14T23:20:36.157 · source: live DB sys.objects/sys.sql_expression_dependencies.

Open formatted source/search result

Parameters

NameTypeOutput
varcharyes
@UID_Personvarcharno

Referenced objects

SchemaObjectColumn/minorClass
BaseTreeOBJECT_OR_COLUMN
DialogCountryOBJECT_OR_COLUMN
DialogDatabaseOBJECT_OR_COLUMN
DialogStateOBJECT_OR_COLUMN
PersonOBJECT_OR_COLUMN
PersonInBaseTreeOBJECT_OR_COLUMN
dboQER_FGIAdminUnitForPerson_helpOBJECT_OR_COLUMN

Source excerpt

First extracted SQL definition lines from the exported source. Use the full source page for complete context.

Open full formatted source

1create   function dbo.QER_FGIAdminUnitForPerson ( @UID_Person varchar(38) ) returns varchar(138) as begin declare @ObjectkeyAdminUnit varchar(138
2)  declare @uid_dialogcountry varchar(38) declare @uid_dialogState varchar(38) declare @uid_locality varchar(38) declare @uid_department varchar(38) declare
3 @uid_ProfitCenter varchar(38)  select top 1 @uid_dialogcountry = c.UID_DialogCountry , @uid_dialogState = s.UID_DialogState , @uid_locality = p.UID_Locality
4 , @uid_department = p.UID_Department , @uid_ProfitCenter = p.UID_ProfitCenter  from Person p left outer join DialogState s on p.UID_DialogState = s.UID_DialogState
5 and s.IsInUse = 1 left outer join DialogCountry c on p.UID_DialogCountry = c.UID_DialogCountry and c.IsInUse = 1 where p.UID_Person = @UID_Person  if 
6@uid_dialogState is not null begin  return(dbo.QER_FGIAdminUnitForPerson_help (@uid_dialogcountry , @uid_dialogState)) end  if @uid_dialogCountry is not
7 null begin  return(dbo.QER_FGIAdminUnitForPerson_help (@uid_dialogcountry , @uid_dialogState)) end if @uid_locality is not null begin select top 1 @uid_dialogcountry
8 = c.UID_DialogCountry , @uid_dialogState = s.UID_DialogState from BaseTree p left outer join DialogState s on p.UID_DialogState = s.UID_DialogState and
9 s.IsInUse = 1 left outer join DialogCountry c on p.UID_DialogCountry = c.UID_DialogCountry and c.IsInUse = 1 where p.UID_Org = @uid_locality and (c.UID_DialogCountry
10 is not null or s.UID_DialogState is not null ) if @@rowcount > 0 begin  return(dbo.QER_FGIAdminUnitForPerson_help (@uid_dialogcountry , @uid_dialogState
11)) end end if @uid_department is not null begin select top 1 @uid_dialogcountry = c.UID_DialogCountry , @uid_dialogState = s.UID_DialogState from BaseTree
12 p left outer join DialogState s on p.UID_DialogState = s.UID_DialogState and s.IsInUse = 1 left outer join DialogCountry c on p.UID_DialogCountry = c.UID_DialogCountry
13 and c.IsInUse = 1 where p.UID_Org = @uid_department and (c.UID_DialogCountry is not null or s.UID_DialogState is not null ) if @@rowcount > 0 begin  return
14(dbo.QER_FGIAdminUnitForPerson_help (@uid_dialogcountry , @uid_dialogState)) end end if @uid_ProfitCenter is not null begin select top 1 @uid_dialogcountry
15 = c.UID_DialogCountry , @uid_dialogState = s.UID_DialogState from BaseTree p left outer join DialogState s on p.UID_DialogState = s.UID_DialogState and
16 s.IsInUse = 1 left outer join DialogCountry c on p.UID_DialogCountry = c.UID_DialogCountry and c.IsInUse = 1 where p.UID_Org = @uid_ProfitCenter and (c.UID_DialogCountry
17 is not null or s.UID_DialogState is not null ) if @@rowcount > 0 begin  return(dbo.QER_FGIAdminUnitForPerson_help (@uid_dialogcountry , @uid_dialogState
18)) end end  select top 1 @uid_dialogcountry = c.UID_DialogCountry , @uid_dialogState = s.UID_DialogState from PersonInBaseTree pio join BaseTree b on pio.UID_Org
19 = b.UID_Org join ( values (1, 'QER-V-Locality' ) , (2, 'QER-V-Department' ) , (3, 'QER-V-ProfitCenter' ) ) as x (sortier, UID_OrgRoot) on x.UID_OrgRoot
20 = b.UID_OrgRoot and pio.XOrigin > 0 left outer join DialogState s on b.UID_DialogState = s.UID_DialogState and s.IsInUse = 1 left outer join DialogCountry
21 c on b.UID_DialogCountry = c.UID_DialogCountry and c.IsInUse = 1 where pio.UID_Person = @uid_person and (c.UID_DialogCountry is not null or s.UID_DialogState
22 is not null ) order by x.sortier, b.uid_org if @@rowcount > 0 begin  return(dbo.QER_FGIAdminUnitForPerson_help (@uid_dialogcountry , @uid_dialogState)
23) end select top 1 @uid_dialogCountry = c.uid_dialogCountry from DialogDatabase d with (readpast) join DialogCountry c with (readpast) on c.UID_DialogCountry
24 = d.UID_DialogCountryDefault if @@rowcount > 0 begin return(dbo.QER_FGIAdminUnitForPerson_help (@uid_dialogcountry , @uid_dialogState)) end select top
25 1 @uid_dialogCountry = uid_dialogCountry from dialogcountry where isInuse = 1 and telephone > ' ' order by Telephone asc, Iso3166_3 desc if @@rowcount
26 > 0 begin  return(dbo.QER_FGIAdminUnitForPerson_help (@uid_dialogcountry , @uid_dialogState)) end select top 1 @uid_dialogCountry = uid_dialogCountry 
27from dialogCountry where telephone > ' ' order by Telephone asc, Iso3166_3 desc endLabel: return(dbo.QER_FGIAdminUnitForPerson_help (@uid_dialogcountry
28 , @uid_dialogState)) end 
29

Module relation graph

Loading module relation graph…

Source-derived context

Generated from exported SQL module definitions plus read-only sandbox sys.objects/sys.parameters/sys.sql_expression_dependencies metadata. This is factual source evidence, not a semantic guess.

provenance: SQL definition export provenance: sandbox DB metadata modified: 2026-04-14T23:20:36.157

None extracted.

Summary: reads/joins Person, DialogState, DialogCountry, BaseTree, PersonInBaseTree…

Declared parameters

ParameterTypeDirection
varchar(138)OUTPUT
@UID_Personvarchar(38)input

DML targets

None extracted.

Called routines

None extracted.

Config/session

Config: None extracted.

Session: None extracted.

DBQueue/tasks

None extracted.

Temp tables / referenced variables

Temp: None extracted.

Variables: @UID_Person @ObjectkeyAdminUnit @uid_dialogcountry @uid_dialogState @uid_locality @uid_department @uid_ProfitCenter @uid_dialogCountry @rowcount @uid_person

Referenced by / reverse dependencies

Generated from live DB metadata, FK rows, and exported SQL dependency/source extraction. This is factual linkage evidence, not inferred behavior.

Referencing objectRelationEvidence
dbo.QER_FCVTimeToWorkTimePersonSQL expression dependencydbo · OBJECT_OR_COLUMN