--- [EMAIL PROTECTED] wrote:

> 
> 
> 
> 
> Question:
> I have a perl %HASH that contains the column names and
> type for the TABLE I
> am trying to create.
> HOW can I achieve such a task?
> I have looked into SQL::Abastract DBIx::Simple and DBI
> without any success.
> 
> Regards,
> 
> Uriel_Carrasquilla
> 

You might have to use the brute force method of looping
through the hash and building the SQL statement as you go. 
So, assuming the hash key names represent the column names,
and the values contain the datatypes, you could do
something like:

$tableName = 'MY_TABLE';
$sqlCreate = "create table $tableName (";
foreach $i (keys %schemaHash) {
   $sqlCreate .= "$i $schemaHash{$i},\n";
}
$sqlCreate .= ');';
$dbh->do($sqlCreate);

But then, you were probably trying to avoid having to do it
this way :-(

 -Clark

Reply via email to