TVF_StudentEnrolmentCreateDate

The list of table valued functions used by Guildford College Reports and any anyone else wishes to share
Post Reply
User avatar
robinwilson16
Site Admin
Posts: 184
Joined: Sun Oct 16, 2016 6:46 pm
Forename: Robin
Surname: Wilson
College Name: FEA
Position: MIS Consultant
LinkedIn Profile: https://www.linkedin.com/in/robinwilson16

TVF_StudentEnrolmentCreateDate

Post by robinwilson16 » Thu Mar 02, 2017 11:57 pm

Displays the created date of the specified enrolment using the audit data

Code: Select all

CREATE FUNCTION [dbo].[TVF_StudentEnrolmentCreateDate] (
	@Session VARCHAR(7), 
	@StudentEnrolmentID numeric(16, 0)
)
RETURNS TABLE
AS
RETURN 
	/*
	DECLARE @Session NVARCHAR(7) = '2015-16'
	DECLARE @StudentEnrolmentID numeric(16, 0) = 727000003893609
	DECLARE @Property VARCHAR(20) = 'status'
	DECLARE @DateChanged DateTime = '2016-06-01'
	*/
	--6

	SELECT
		Value = MIN ( SAT.sat_start )
	FROM ulive.dbo.capd_moduleenrolment ME
	LEFT JOIN ulive.dbo.CAPS_SYSTEM_AUDIT_TRAIL SAT
		ON SAT.sat_id = ME.e_id	
	WHERE	
		ME.e_id	= @StudentEnrolmentID

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests