Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 3 of 3 total |
How to create a new table from existing table structure? |
Sat, Aug 25 2012 2:04 PM | Permanent Link |
Barry | I'd "like" to be able to execute:
create NewTable like OldTable; -- This works in MySQL but that doesn't work because EDB doesn't know how to interpret "Like". I know I can execute: create table NewTable as select * from OldTable with no data; but of course that doesn't create the indexes or triggers. Is there an easy way to use SQL to create a new table structure based on an existing table? I don't need the data, just the columns, indexes, and triggers. TIA Barry |
Sat, Aug 25 2012 6:30 PM | Permanent Link |
Uli Becker | Barry,
> Is there an easy way to use SQL to create a new table structure based on an existing table? I don't need the data, just the columns, indexes, and triggers. That was discussed earlier. At the moment it's not possible. But there is an undocumented feature in EDBManager that will help you: Just create an emypt script, drag a table from the treeview into the body of the script, do the same with all indexes and triggers. That will create the code you need very quickly. Uli |
Wed, Sep 5 2012 8:21 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Barry,
<< but that doesn't work because EDB doesn't know how to interpret "Like". >> Wrong syntax, use this instead: CREATE TABLE NewTable ( LIKE OldTable ) That's the standard syntax, and allows you to do things like this: CREATE TABLE NewTable ( LIKE OldTable, LIKE AnotherOldTable ) However, there is one caveat - this will only copy the columns over and not any constraints, etc. You have to define those manually, at least for now. If you have any other questions, please let me know. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Sunday, May 5, 2024 at 10:18 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |