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

Error readable from string in D365FO

 Reference class: RetailSyncOrdersSchedulerTask Error readable: private str generateHumanReadableErrorDetail(System.Exception _exception, st...