That worked like a charm, thanks so much! I don't know why I didn't try that before!
Julian


At 02:46 PM 11/21/2003 -0600, Paul DuBois wrote:
At 10:56 -0500 11/21/03, Julian Zottl wrote:
Andy,
Thanks for responding. I think that I am going to go with the idea of creating a tale for each day. My thoughts were to write a shell script to do this for me, but I am running into a problem: I wrote the following:
#!/bin/sh
date=`date "+%m%d%Y"`
export date
mysql -u root -p < createdb.sql


Then in createdb.sql
CONNECT Blah;
CREATE TABLE $date (
.....
) TYPE=MyISAM;

But it's not passing the $date variable to SQL :/ I've been looking on the web for a way to do this, but have yet to find it. any ideas?

You could use a here-document instead of createdb.sql


#!/bin/sh
date=`date "+%m%d%Y"`

mysql -u root -p <<EOF
CONNECT Blah;
CREATE TABLE t$date (
......
) TYPE=MyISAM;
EOF

I put a "t" before $date -- you don't want to try creating a table
with a name that's all digits.  That makes it indistinguishable from
a number, so you'd have to quote it with backticks every time you refer
to it.


Julian


--
Paul DuBois, Senior Technical Writer
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

Are you MySQL certified? http://www.mysql.com/certification/


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]


Julian Zottl Unix Systems Administrator NASA HQ - 202-358-1682


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to