Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 4 of 4 total |
CREATE TABLE IF NOT EXISTS |
Thu, Jun 9 2011 10:12 PM | Permanent Link |
IQA | I'm just wondering if EDB SQL has the equivelant of: CREATE TABLE IF NOT EXISTS
I know I can query the information database and check for table names... But the reason I ask is, I am using a EDBScript component to load an SQL file which creates 50 or so tables with "default data" when my program is executed, so that initially the tables are created if it's the first run and also any tables not created will be created, but I don't want to hard code checking of 50 tables which could also change to become 55 tables in future releases. I just want to add something like CREATE TABLE IF NOT EXISTS to my .SQL file so that if the table doesn't exist it will be created. Thanks |
Fri, Jun 10 2011 2:54 AM | Permanent Link |
David Cornelius Cornelius Concepts | No, but you can write a function to do it. Or copy one I did:
http://www.elevatesoft.com/forums?action=view&category=edb&id=edb_extensions&msg=38&page=1 Actually, that function can now be shortened to eliminate cursors with new extensions in EDB: http://www.elevatesoft.com/manual?action=viewtopic&id=edb2sql&topic=EXECUTE_IMMEDIATE Hope that helps! David Cornelius Cornelius Concepts |
Fri, Jun 10 2011 4:04 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Philip
>I'm just wondering if EDB SQL has the equivelant of: CREATE TABLE IF NOT EXISTS To my eternal sadness that syntax didn't make it into ElevateDB. However, since you're using a script the easiest way is either use David's approach or simply wrap the create statement in BEGIN EXCEPTION END. My preferred approach is testing the configuration but I just don't like exceptions, even nicely handled ones. Roy Lambert [Team Elevate] |
Fri, Jun 10 2011 7:15 AM | Permanent Link |
IQA | Thanks David (nifty function) works well and thanks Roy, your right I don't like relying on exceptions either.
|
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |