Page 1 of 1

TVF_StudentApplicationCreateDate

Posted: Thu Mar 02, 2017 11:56 pm
by robinwilson16
Displays the created date of the specified student application using the audit data

Code: Select all

CREATE FUNCTION [dbo].[TVF_StudentApplicationCreateDate] (
	@Session VARCHAR(7), 
	@StudentApplicationID numeric(16, 0)
)
RETURNS TABLE
AS
RETURN 
	/*
	DECLARE @Session NVARCHAR(7) = '2015-16'
	DECLARE @StudentApplicationID numeric(16, 0) = 727000028107233
	*/
	--notapplied

	SELECT
		Value = MIN ( SAT.sat_start )
	FROM ulive.dbo.capd_studentapplication SA
	LEFT JOIN ulive.dbo.CAPS_SYSTEM_AUDIT_TRAIL SAT
		ON SAT.sat_id = SA.sa_id	
	WHERE	
		SA.sa_id = @StudentApplicationID