Two problems here. 1/ Getting the tables' names and columns from the database.
2/ Constructing the SQL from that information. The second part is easy: foreach $table ( GetTables() ) { print "CREATE VIEW_$table AS\n"; print "SELECT ("; $n = 0; foreach $column ( GetColumns ($table) ) { print ", " if $n++; print $column; } print ") FROM $table;\n"; } Which may be enough for you. GetTables() and GetColumns() are the first part, and I can't say any more about what these might do without knowing more about what interface you have with the database. HTH Rob ----- Original Message ----- From: "Vincent Lee" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, October 15, 2002 3:37 PM Subject: Re: creating a string on the fly > I'm starting with data in the database. It's SQL statements and I'm > populating arrays in perl. > > I don't need to build a hash but the statement. I thought an array or hash > would be the easiest. > > [EMAIL PROTECTED] wrote: > > > >Vincent > > > >I will have several suggestions, but I need to know what data you're > >starting with, and what form it's in. Are you starting with a real database > >or just a paper specification? Is the hash you're describing something you > >need to build anyway or is it simply a means to build the SQL statement? > > > >Bring the answer back to the mail group so that others can learn. > > > >Cheers, > > > >Rob > > > >----- Original Message ----- > >From: "Vincent Lee" <[EMAIL PROTECTED]> > >To: "Rob" <[EMAIL PROTECTED]> > >Sent: Tuesday, October 15, 2002 3:03 PM > >Subject: Re: creating a string on the fly > > > > > >> Hi Rob, > >> > >> Thanks for helping me out!! > >> > >> Yes you are correct...hmmm...so yes, I didn't > >> understand what I was doing (new to perl). > >> > >> Any suggestions on what I could do? > >> > >> I just want to be able to create a string that takes > >> this information and makes a create view statement > >> > >> "CREATE VIEW_$TABLENAME AS SELECT [array of > >> columns]...." > >> > >> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]