Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- USE [SDS_DevSchoolDistrict]
- GO
- -- =============================================
- -- Author: School Data Solutions
- -- Create date: <Create Date, ,>
- -- Description: <Description, ,>
- -- Copyright 2011-2012 School Data Solutions, All Rights Reserved
- -- =============================================
- CREATE FUNCTION [dbo].[WidgetDataForStudentLearningPlanForPrintAsXml]
- (
- @EntityId int,
- @SchoolYearId int = NULL,
- @IncludeHeader bit = 1,
- @DataViewMode varchar(200) = 'Standard',
- @EncryptIds bit = 0,
- @ApplicationUserId int,
- @ApplicationUserPersonRoleId int
- )
- RETURNS Xml
- AS
- BEGIN
- /*---------------------------------------------
- DECLARE @EntityId int = 38515
- DECLARE @DataViewMode varchar(200) = 'Standard'
- DECLARE @EncryptIds bit = 0
- DECLARE @IncludeHeader bit = 1
- DECLARE @ApplicationUserId int = 357
- DECLARE @ApplicationUserPersonRoleId int = 1
- -- SELECT dbo.WidgetDataForStudentLearningPlanForPrintAsXml(34261, 12, 1, DEFAULT, DEFAULT, 357, 1)
- ---------------------------------------------*/
- ---------------------------------------------
- -- Declare the return variable here
- -- Prepare for performance metrics
- ---------------------------------------------
- DECLARE @StartTime time = CAST(GETDATE() as time)
- DECLARE @Xml XML = '<Xml xmlAssemblyTimeInMilliseconds=""></Xml>'
- ---------------------------------------------
- ---------------------------------------------
- DECLARE @Entity Xml
- ---------------------------------------------
- IF(@IncludeHeader = 1)
- BEGIN
- DECLARE @PersonRoleId int
- ---------------------------------------------
- SELECT @PersonRoleId = PersonRoleId
- FROM PersonRoles PR
- WHERE PR.PersonRole LIKE '%Student%'
- ---------------------------------------------
- SET @Entity = dbo.WidgetDataForEntityProfileAsXml(@EntityId, @PersonRoleId, @SchoolYearId, @DataViewMode, @EncryptIds, @ApplicationUserId, @ApplicationUserPersonRoleId)
- END
- ---------------------------------------------
- --SELECT @Entity AS '@Entity'
- ---------------------------------------------
- IF(@SchoolYearId IS NULL) SET @SchoolYearId = dbo.SchoolYearIdValue(getDate())
- ---------------------------------------------
- -- Assemble output Xml
- ---------------------------------------------
- SET @Xml = dbo.WidgetDataForStudentLearningPlanAsXml(@EntityId, @SchoolYearId, @DataViewMode, @EncryptIds, @ApplicationUserId, @ApplicationUserPersonRoleId)
- SET @Xml = dbo.XmlAdopt(@Xml, @Entity, 'Xml', 'Entity')
- ---------------------------------------------
- ALLDONE:
- ---------------------------------------------
- -- Track Assembly time
- ---------------------------------------------
- DECLARE @XmlAssemblyTimeInMilliseconds int = DATEDIFF(ms, @StartTime, CAST(GETDATE() as time))
- SET @Xml = dbo.XmlAssignAttributeValues(@Xml, '//Xml', 'xmlAssemblyTimeInMilliseconds', @XmlAssemblyTimeInMilliseconds)
- ---------------------------------------------
- --SELECT @Xml AS '@Xml'
- ---------------------------------------------
- RETURN @Xml
- END
Add Comment
Please, Sign In to add comment