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