Thursday, October 5, 2017

Gets the AX table ID for the table name in SQL Function


ALTER FUNCTION  fnGetAXTableID
(
    @tableName nvarchar(100)
)
RETURNS int
AS
BEGIN
    DECLARE @tableNum int
 
    SELECT @tableNum = TableID
    FROM SQLDictionary
    WHERE [Name] = @tableName
        AND FieldID = 0
        AND Array = 0

    RETURN @tableNum

END

//Call Scalar Function in SQL Query

select  dbo.fnGetAXTableID('MyTable') as [TableId]

No comments:

Post a Comment

Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...