dbo.QBM_FTPrimaryKeyInfo_BTVP
Inline Table FunctionSQL_INLINE_TABLE_VALUED_FUNCTIONSandbox DB
Interpretation
- Database function. Usually supports views, validation, or calculated predicates; look at referenced-by entries for callers.
Relations
- No extracted relations.
Typed Edges
- references source dbo.QBM_FTPrimaryKeyInfo_BT source text reference
- references source dbo.QBM_FTPrimaryKeyInfo_BTV source text reference
Complete Source
1CREATE FUNCTION dbo.QBM_FTPrimaryKeyInfo_BTVP(2) RETURNS TABLE3AS4RETURN(5SELECT6 TableName,7 ColumnName,8 UID_DialogColumn,9 UID_DialogTable,10 TableType,11 OrdinalPosition,12 IsPKMember,13 IsPKName1,14 IsPKName2,15 UID_DialogColumnUnionView16FROM dbo.QBM_FTPrimaryKeyInfo_BTV() v17UNION all18SELECT19 p.TableName,20 c.ColumnName,21 c.UID_DialogColumn,22 p.UID_DialogTable,23 p.TableType,24 ROW_NUMBER() over(partition BY c.uid_dialogtable25ORDER BY c.columnname) AS OrdinalPosition,26y.IsPKMember,270 AS IsPKName1,280 AS IsPKName2,29NULL AS UID_DialogColumnUnionView30FROM DialogColumn c31 WITH(readpast)32JOIN Dialogtable p33 WITH(readpast)34 ON c.UID_DialogTable = p.UID_DialogTable35JOIN(36SELECT37 pc.UID_DialogColumn, sign(MAX(convert(int, ba.IsPKMember))) AS IsPKMember38FROM DialogColumn pc39 WITH(readpast)40JOIN dbo.QBM_FTPrimaryKeyInfo_BTV() ba41 ON pc.UID_DialogColumn = ba.UID_DialogColumnUnionView42GROUP BY pc.UID_DialogColumn) AS y43 ON y.UID_DialogColumn = c.UID_DialogColumn)
Open raw exported source
1create function dbo.QBM_FTPrimaryKeyInfo_BTVP() returns table as return ( select TableName,ColumnName, UID_DialogColumn, UID_DialogTable, TableType, 2OrdinalPosition, IsPKMember, IsPKName1, IsPKName2, UID_DialogColumnUnionView from dbo.QBM_FTPrimaryKeyInfo_BTV() v union all select p.TableName, c.ColumnName3, c.UID_DialogColumn, p.UID_DialogTable, p.TableType , ROW_NUMBER() over ( partition by c.uid_dialogtable order by c.columnname) as OrdinalPosition , y.IsPKMember4 , 0 as IsPKName1 , 0 as IsPKName2 , null as UID_DialogColumnUnionView from DialogColumn c with (readpast) join Dialogtable p with (readpast) on c.UID_DialogTable5 = p.UID_DialogTable join ( select pc.UID_DialogColumn, sign(MAX(convert(int, ba.IsPKMember))) as IsPKMember from DialogColumn pc with (readpast) join 6dbo.QBM_FTPrimaryKeyInfo_BTV() ba on pc.UID_DialogColumn = ba.UID_DialogColumnUnionView group by pc.UID_DialogColumn ) as y on y.UID_DialogColumn = c.UID_DialogColumn7 ) 8