From the previous example, you saved the GenderText variable as such ...
[%SetValue(GenderText,Label(Q1))%]
This would simply save "Male" or "Female" to the SQL database based on Q1 being the gender question.
Given you are now changing the text you wish to save to the SQL database, try this ...
[%Begin Unverified Perl
if(VALUE("Q1")==1)
{
SETVALUE("GenderText",'Male (5679)');
}
if(VALUE("Q1")==2)
{
SETVALUE("GenderText",'Female (5680)');
}
End Unverified%]
This will now write "Male (5679)" or "Female (5680)" to the SQL database.