SPONSORSHIPOPPORTUNITYCHILD

Stores child sponsorship opportunities.

Primary Key

Primary Key Field Type
ID uniqueidentifier

Fields

Field Field Type Null Notes Description
FIRSTNAME nvarchar(50) Default = '' For individuals, stores the first name.
MIDDLENAME nvarchar(50) Default = '' For individuals, stores the middle name.
LASTNAME nvarchar(100) Default = '' Last name of child
GENDERCODE tinyint Default = 0 0=Unknown, 1=Male, 2=Female
GENDER nvarchar(7) (Computed) yes CASE [GENDERCODE] WHEN 0 THEN N'Unknown' WHEN 1 THEN N'Male' WHEN 2 THEN N'Female' END Provides a translation for the 'GENDERCODE' field.
BIRTHDATE UDT_FUZZYDATE Default = '00000000' For individuals, stores the date of birth.
ISHIVPOSITIVE bit Default = 0 Indicates if child sponsorship opportunity is HIV+
ISORPHANED bit Default = 0 Indicates if a child sponsorship opportunity is an orphan
PICTURE varbinary yes A photo or emblem for this child.
PICTURETHUMBNAIL varbinary yes
NAME nvarchar(154) (Computed) yes CASE FIRSTNAME WHEN '' THEN '' ELSE FIRSTNAME + ' ' END + CASE MIDDLENAME WHEN '' THEN '' ELSE LEFT(MIDDLENAME,1) + '. ' END + LASTNAME Returns the child name (First + Middle Initial + Last (individuals)).
DATEADDED datetime Default = getdate() Indicates the date this record was added.
DATECHANGED datetime Default = getdate() Indicates the date this record was last changed.
TS timestamp Timestamp.
TSLONG bigint (Computed) yes CONVERT(bigint, TS) Numeric representation of the timestamp.
AGE int (Computed) yes dbo.UFN_CONSTITUENT_GETAGE(SPONSORSHIPOPPORTUNITYCHILD.CONSTITUENTID) For child, returns the age.

Foreign Keys

Foreign Key Field Type Null Notes Description
ID uniqueidentifier SPONSORSHIPOPPORTUNITY.ID Primary Key.
SPROPPCHILDCONDITIONCODEID uniqueidentifier yes SPROPPCHILDCONDITIONCODE.ID FK to SPROPPCHILDCONDITIONCODE
ADDEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.
CHANGEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.
CONSTITUENTID uniqueidentifier CONSTITUENT.LOCALID Constituent record for this child

Indexes

Index Name Fields Unique Primary Clustered
IX_SPONSORSHIPOPPORTUNITYCHILD_DATEADDED DATEADDED yes
IX_SPONSORSHIPOPPORTUNITYCHILD_DATECHANGED DATECHANGED
IX_SPONSORSHIPOPPORTUNITYCHILD_SPROPPCHILDCONDITIONCODEID SPROPPCHILDCONDITIONCODEID
PK_SPONSORSHIPOPPORTUNITYCHILD ID yes yes
UC_SPONSORSHIPOPPORTUNITYCHILD_CONSTITUENTID CONSTITUENTID yes

Triggers

Trigger Name Description
TR_SPONSORSHIPOPPORTUNITYCHILD_AUDIT_ETLDELETEDID
TR_SPONSORSHIPOPPORTUNITYCHILD_AUDIT_UPDATE
TR_SPONSORSHIPOPPORTUNITYCHILD_AUDIT_DELETE