Thanks for the tip,
But what if I am using Microsoft SQL server 7?
is there a way to do this?
eric

-----Original Message-----
From: dave hoover [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 05, 2001 12:43 PM
To: Eric Wang; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: creating columns on the fly 


Eric Wang wrote:
[snip]
> First, I decided that I will need to generate the
> SQL statements inside
> the perl script. (i.e. print SQL "insert...
> blah..").  

If you use DBI, this is no problem, in fact, it's
expected.  You will probably call
$sth->execute(SQL_HERE).  You can plug in a previously
generated scalar variable at SQL_HERE.

> But, I need to know
> if this column I insert into has already existed or
> not? if not, create
> it, otherwise just insert it. So, the simple
> question is can I do this?
[snip]

Yes. You can query the database first to see if it's
there, then based on the results, construct your SQL
statement with UPDATE/INSERT accordingly.



=====
Dave Hoover
"Twice blessed is help unlooked for." --Tolkien
http://www.redsquirreldesign.com/dave

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Reply via email to