Hi @Leah Adams
Try this:
CREATE FUNCTION [dbo].[GetAsOfDate_AccountView] (@tblID int, @asOfDate datetime2(2))
RETURNS @Return_Tbl TABLE (col1 INT,col2 INT)
AS
BEGIN
INSERT @Return_Tbl(col1,col2)
SELECT col1,col2
FROM [dbo].[AccountView] FOR SYSTEM_TIME AS OF @asOfDate
WHERE [Account No] = @tblID
RETURN
END
Best regards,
Cosmog Hong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.