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

Dynamically setting entire Form security access through Extension in D365FO

/// <summary> /// To check if user can get access to the Parameter form /// </summary> class SAN_ParamFormsAccessCtrl {     prot...