Specifically I have a function with the following signature:
CREATE FUNCTION [dbo].[GetLevelData]()
RETURNS @level TABLE (
[Level] INT PRIMARY KEY IDENTITY,
[Source Column Name] AS '{Option Level ' + CAST([Level] AS VARCHAR(10)) + '}',
[Parent Column Name] AS '[Parent_L' + CAST([Level] AS VARCHAR(10)) + '_Option]'
)
How can I insert rows into it without modifying the definition of the table?
Within the body of the function definition, use
to create a new row in the to-be-returned table.
To do a number of rows at once, you can do this:
which is a bit sneaky but does work