Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 6 of 6 total |
create/restructure table from script |
Tue, Jan 31 2006 3:36 AM | Permanent Link |
"Harry de Boer" | LS.
What would be the proper way to create a SQL script that -checks if a table exists otherwise creates it -checks if (if the table is there) a field exists otherwise creates it -checks if (if the table and field are there) a field type, length etc are correct exists otherwise corrects it -checks if (if the table is there) an index exists otherwise creates it and doesn't loose the data the table already contains. dbIsam 3.30 Regards, Harry |
Tue, Jan 31 2006 5:56 AM | Permanent Link |
"Harry de Boer" | ...or is this better to be done in object pascal?
"Harry de Boer" <harry@staaf.nl> schreef in bericht news:05EFEAA9-86AD-4E5D-BDF6-CF0452E2BDDD@news.elevatesoft.com... > LS. > > What would be the proper way to create a SQL script that > -checks if a table exists otherwise creates it > -checks if (if the table is there) a field exists otherwise creates it > -checks if (if the table and field are there) a field type, length etc are > correct exists otherwise corrects it > -checks if (if the table is there) an index exists otherwise creates it > and doesn't loose the data the table already contains. > > dbIsam 3.30 > > Regards, Harry > > |
Tue, Jan 31 2006 7:21 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Harry
I can't remember when some features made it into DBISAM. Certainly on V4 you should be able to do things like CREATE TABLE IF NOT EXISTS ... ALTER TABLE IF EXISTS .... REDEFINE COLUMN IF EXISTS .... ADD COLUMN IF NOT EXISTS The thing you can't do (or I don't know how) is along the lines of CREATE TABLE IF NOT EXISTS else ALTER TABLE ..... Roy Lambert |
Tue, Jan 31 2006 7:37 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Harry,
<< What would be the proper way to create a SQL script that -checks if a table exists otherwise creates it -checks if (if the table is there) a field exists otherwise creates it -checks if (if the table and field are there) a field type, length etc are correct exists otherwise corrects it -checks if (if the table is there) an index exists otherwise creates it and doesn't loose the data the table already contains. >> With 3.x, I don't think you can use the EXISTS keyword with columns, so you'll probably have to resort to OP to code the alter table. Check out the Restructuring Tables topic in the manual for more information. -- Tim Young Elevate Software www.elevatesoft.com |
Tue, Jan 31 2006 2:12 PM | Permanent Link |
"Malcolm" | Harry
You could look at Peter Mora's DbisamDsnTbl component which I think can do all those things with minimum effort on your part. It uses Pascal as V3 SQL could not do it. Search the binaries ng for it. I have used it extensively to manage database restructuring in DBISAM V3 and V4 Sample code... with A_DbisamDsnTbl do begin if not Exists then MakeTable; else if not CompareStructure then UpdateTable; end; Now, if only .... Malcolm |
Wed, Feb 1 2006 10:12 AM | Permanent Link |
"Harry de Boer" | Thanks
Sounds like what I need. I will look into it. Regards, Harry "Malcolm" <malcolm@spam.will.bounce> schreef in bericht news:60F4767F-98F9-483B-806A-2E2879063A9E@news.elevatesoft.com... > Harry > > You could look at Peter Mora's DbisamDsnTbl component which > I think can do all those things with minimum effort on your > part. > > It uses Pascal as V3 SQL could not do it. > > Search the binaries ng for it. > > I have used it extensively to manage database restructuring > in DBISAM V3 and V4 > > Sample code... > > with A_DbisamDsnTbl do > begin > if not Exists then > MakeTable; > else if not CompareStructure then > UpdateTable; > end; > > Now, if only .... > > Malcolm |
This web page was last updated on Saturday, May 4, 2024 at 12:54 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |