dbo.QBM_FTPrimaryKeyInfo_BT
SQL_INLINE_TABLE_VALUED_FUNCTION
Created 2026-04-14T23:16:32.093 · modified 2026-04-14T23:16:32.093 · source: live DB sys.objects/sys.sql_expression_dependencies.
Parameters
| Name | Type | Output |
|---|---|---|
| No parameters. | ||
Referenced objects
| Schema | Object | Column/minor | Class |
|---|---|---|---|
| DialogColumn | OBJECT_OR_COLUMN | ||
| DialogTable | OBJECT_OR_COLUMN |
Source excerpt
First extracted SQL definition lines from the exported source. Use the full source page for complete context.
1create function dbo.QBM_FTPrimaryKeyInfo_BT( ) returns table as return ( select e.TableName , e.ColumnName , e.UID_DialogColumn , e.UID_DialogTable , e.TableType 2 , e.OrdinalPosition , sign(isnull(y.PK1Position, 0) + isnull(y.PK2Position, 0)) as IsPKMember , case y.PK1Position when e.OrdinalPosition then 1 else 30 end as IsPKName1 , case y.PK2Position when e.OrdinalPosition then 1 else 0 end as IsPKName2 , e.UID_DialogColumnUnionView from ( select t.TableName, 4 c.ColumnName, c.UID_DialogColumn, t.UID_DialogTable, t.TableType , c.UID_DialogColumnUnionView , ( columnproperty(sc.object_id, sc.name, 'ordinal') ) 5as OrdinalPosition , st.object_id as Table_Object_id from sys.tables st with (readpast) join sys.columns sc with (readpast) on st.object_id = sc.object_id 6 join DialogTable t with (readpast, forceseek) on convert(varchar(30), left(st.name,30)) = t.TableName and t.TableType in('B', 'T', 'M') join DialogColumn 7 c with (readpast, forceseek) on t.UID_DialogTable = c.UID_DialogTable and convert(varchar(30), left(sc.name,30)) = c.ColumnName ) as e left outer join 8( select min(x.ORDINAL_POSITION) as PK1Position , case when max(x.ORDINAL_POSITION) = min(x.ORDINAL_POSITION) then 0 else max(x.ORDINAL_POSITION) end as 9 PK2Position , x.object_id from( select w.COLUMN_NAME , w.ORDINAL_POSITION , w.object_id from( select c.name as COLUMN_NAME , ( columnproperty(t.object_id 10, c.name, 'ordinal') ) as ORDINAL_POSITION , t.object_id from sys.tables t with (readpast) join sys.indexes i with (readpast) on t.object_id = i.object_id 11 and i.is_hypothetical = 0 and i.type not in (3,4,5,6) join sys.index_columns ic with (readpast) on i.index_id = ic.index_id and ic.object_id = t.object_id 12 join sys.columns c with (readpast) on c.object_id = t.object_id and ic.column_id = c.column_id where i.is_primary_key = 1 ) as w group by w.object_id 13, w.COLUMN_NAME , w.ORDINAL_POSITION ) as x group by x.object_id ) as y on e.Table_Object_id = y.object_id and ( e.OrdinalPosition in ( y.PK1Position, 14y.PK2Position) ) ) 15
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:16:32.093
None extracted.
Summary: reads/joins sys, DialogTable, DialogColumn
Declared parameters
No declared parameters in sys.parameters for this object, or metadata was not available.
DML targets
None extracted.Called routines
None extracted.
Read/join references
SQL dependency metadata
Config/session
Config: None extracted.
Session: None extracted.
DBQueue/tasks
None extracted.Temp tables / referenced variables
Temp: None extracted.
Variables: None extracted.
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 object | Relation | Evidence |
|---|---|---|
| dbo.QBM_FTPrimaryKeyInfo_BTV | SQL expression dependency | dbo · OBJECT_OR_COLUMN |
| dbo.QBM_PDialogTablePKNameCorrect | SQL expression dependency | dbo · OBJECT_OR_COLUMN |
| dbo.QBM_FTPrimaryKeyInfo_BTV | source text reference | SQL_INLINE_TABLE_VALUED_FUNCTION |
| dbo.QBM_PDialogTablePKNameCorrect | source text reference | has TRY/CATCH error handling |