Update Values with School Codes
The Cst_Si_Configurations_Update_Values_GetStudLifeCycle_Status.sql script updates the Values column in the Si_Configurations table with comma-separated School Codes .
For more details about the script, refer to Si_Configurations Table Update Scripts.
declare @RowCount int
declare @UserID int
declare @data varchar(max)
set @RowCount = 0
--Getting the value of @data as comma separated list <Start>
/*
select @data = COALESCE(@data + ',' + convert(varchar,ltrim(rtrim(SySchoolStatus.Code))), convert(varchar,ltrim(rtrim(SySchoolStatus.Code))))
from dbo.SyStatus(nolock)
inner join dbo.SySchoolStatus (nolock)
on SySchoolStatus.syStatusID = SyStatus.syStatusID
where SyStatus.Category = 'A'
and SySchoolStatus.Active = 1
order by SySchoolStatus.code
*/
--Getting the value as comma seperated list <End>
--enter the value as comma seperated list
set @data = ''
begin try
begin transaction
set @UserID = dbo.fn_SystemStaffID()
if exists (select 'true' from dbo.si_Configurations(nolock) where ltrim(rtrim([Key])) ='GetStudLifeCycle_Status')
begin
update dbo.si_Configurations
set Value = @data,
UserId = @UserID,
DateLstMod = getDate()
from dbo.si_Configurations(nolock)
where ltrim(rtrim([Key])) ='GetStudLifeCycle_Status'
select @RowCount = @RowCount + @@rowcount
exec dbo.sproc_System_Script_AffectedRecords_Update @RowCount
print 'DML: Cst_Si_Configurations_Update_Values_GetStudLifeCycle_Status.sql ran and Update '+ cast(@RowCount as varchar(10)) + ' row GetStudLifeCycle_Status in Si_Configurations table.'
end
commit transaction
end try
begin catch
declare @ErrorMessage nvarchar(4000);
declare @ErrorSeverity int;
declare @ErrorState int;
if (@@trancount !=0) rollback transaction
SELECT @ErrorMessage = error_message(),
@ErrorSeverity = error_severity(),
@ErrorState = error_State();
Raiserror(@ErrorMessage, @ErrorSeverity, @ErrorState);
end catch
go