Is there a way to send in a string into a T-SQL function and use that string as a "table"
For instance
CREATE FUNCTION [dbo].[TEST] ( @id int, **@table_name** nvarchar(50))
RETURNS @mytables TABLE
(
id int,
values nvarchar(50)
)
AS
BEGIN
INSERT @mytables
SELECT id, values FROM **@table_name**
RETURN
END