Remove Collection Agency Block for Patrons in Record Set

By default the report requires a key that is the MD5 value of the library organization id as a failsafe.

Report can be found here: Bulk Remove Collection Agency Block.rdl (11.4 KB)

Raw SQL here:

-- assigned library and record set to remove block for
declare @library int = 0
declare @recordsetid int = 0
-- change above

-- do not change below
declare @patronid int
declare cur CURSOR LOCAL for
	select prs.PatronID
	from Polaris.Polaris.PatronRecordSets prs 
	join Polaris.Polaris.Patrons p on
		prs.PatronID = p.PatronID
	join Polaris.Polaris.Organizations o on
		p.OrganizationID = o.OrganizationID
	where RecordSetID = @recordsetid and p.SystemBlocks & 1024 = 1024 and o.ParentOrganizationID = @library

open cur

fetch next from cur into @patronid

	exec Polaris.Circ_RemoveCABlockByPatronID @patronid
	fetch next from cur into @patronid

close cur
deallocate cur

select 'done' [status]
1 Like