Compile function Copy_FISCAL_YR_Record_To_SQL(Connection, Key, Record)

/*****************************************************************************\
	Copies the given FISCAL_YR record to the MSSQL database.
	
	History
	-------
	08/09/2010    KRF   Original Programmer
\*****************************************************************************/

Declare function SQL_Write, SQL_Write_MV, SQL_Format
Ans = ""

// Parse record into a dimensioned array for speed
Dim Rec(3)
MatParse Record into Rec
					    
// List of key names and their values
Keys = "FISCAL_YR":@VM:SQL_Format(Key, "INT")

// List of data fields and their values
DataFields  = "START_DT":@VM:SQL_Format(Rec(1), "DATE")

// Write the data to the SQL database
Ans = SQL_Write(Connection, "FISCAL_YR", Keys, DataFields)

//-------------------------------------------------------------------------------------------------
// Multi-valued Fields

// FISCAL_YR_FISCAL_QTR
If Ans EQ "" AND Rec(2) NE "" then
    
    // List of data fields and their values
    MvFields  = "FISCAL_QTR":@FM:SQL_Format(Rec(2), "INT")
    
    // Write the data to the SQL database
    Ans = SQL_Write_MV(Connection, "FISCAL_YR_FISCAL_QTR", Keys, MvFields);
    
end

Return Ans
