I'm writing a script that will generate insert statements for database tables. The only thing holding me back from making this work is finding out what types the columns are. If i know what type they are i can correctly format the values in my insert statement. is there a way to get the type of a specific column name?
ex:
#column's actual value
$val = getValue("AGE_COL");
#getType() is what im looking for
$colType = getType("AGE_COL");
if (isNumeric($colType)) #isNumeric is just a hunch
{
$valuesClause = $valuesClause + ", " + $val;
}
elsif (isText($colType)) #isText is just a hunch
{
$valuesClause = $valuesClause + ", \'" + $val + "\'";
}
...etc...
ex:
#column's actual value
$val = getValue("AGE_COL");
#getType() is what im looking for
$colType = getType("AGE_COL");
if (isNumeric($colType)) #isNumeric is just a hunch
{
$valuesClause = $valuesClause + ", " + $val;
}
elsif (isText($colType)) #isText is just a hunch
{
$valuesClause = $valuesClause + ", \'" + $val + "\'";
}
...etc...