PowerBuilder modifies the skills of database table structure

zhaozj2021-02-16  43

PowerBuilder is currently recognized, one of the best database front-end development tools. In actual development applications, it is often encountered in the case of modifying the database table structure. Modify the database table structure with PowerBuilder and modify the database structure with FoxBase. In PowerBuilder, in addition to adding a field name in the database table structure, no

The method directly modifies the database table structure, such as deleting a field name or type or field name, which will cause loss of database table records. We have concluded a few through practice.

The method is for your reference only, please criticize the correct.

First, modify the database table structure, there is no record in the database table

Method 1: Output the table structure in an export table file format.

Select the database table table to modify from Database.

Select Export Table / View Syntax to log from Objects, save the same SAVE LOG AS, saved in * .sql format.

Select Database Administration from Objects.

Select DOS Open from File, select File Name, *. SQL, open and modify it.

Select EXECUTE SQL from Objects. That is, a new database table structure is generated.

Note: Table name is not the same name.

Method 2: Output the table structure in SQL Syntax file format.

Select the database table table to modify from Database.

Press the Preview button.

Select SAVE ROWS AS, File Format to select SQL Syntax from File, and save the table name * .sql.

Select DOS Open from File, open the table name * .sql, modify it.

After taking the table, Execute SQL.

Note: This method does not generate Primary Key.

Second, modify the database table structure, save the logging of the original database table

Method 1: First modify the database table structure, transfer the database table with the SQL statement

The table 1 is generated in the table 1. SQL, modify the structure, and the table 1 is named Table 2.

Run Table 2. SQL, generate table 2. A new database table structure is generated at this time.

Select Database Administration from Objects, write SQL Statement: INSERT INTO new table name SELECT * FROM old table name; Execute SQL. Turn all fields in the old table into a new table.

Delete Table 1, select DOS Open from File, open the file name File Name, Table 2.SQL, unify table 2 to table

1. Run the table 1. SQL, generate a new structure table 1, there is no record.

Press step 3, all records in Table 2 are all in Table 1.

If some fields are transferred, write SQL Statement:

INSERT INTO new table name (field 1, field 2 ...)

SELECT field 1, field 2. . . . . . Old Name;

Execute SQL. Some fields in the old table are transferred to a new table.

Method 2: Output the table structure and record in SQL Syntax file format.

Select the database table table you want to modify from Database, press the Preview key.

Select SAVE ROWS AS, File Format to select SQL Syntax from File, and save the table name * .sql. Select DOS Open from File, open the table name * .sql, modify it.

After taking the table, Execute SQL.

Method 3: Output the table structure and record in txt file format.

Open the database table from Database, press the Preview key.

Select Save Rows AS, File Format from File to save the table name * .txt.

Generate a table. SQL, modify the structure, and run the table. SQL, generate a new database table structure.

Open the database table from Database, press the Preview key.

Select Import from Rows to select * .txt.

Select Save Changes to Database from File.

Note: Method 1 Applicable to any case of modifying the database table structure. Method 2 and Method 3 do not apply to delete field names.

In addition, the parameters pass the parameters with Message must pay attention to the following:

1. It is best to perform the window operation (open or off) to the value of the value of the Message message object, because Message is a globally used object, each event is triggered or transmitted, and other Script also have It may be used to the Message message object, so it has a danger that is covered.

2.

Avoid transfer

NULL

Objects, so as not to make the program error.

转载请注明原文地址:https://www.9cbs.com/read-26078.html

New Post(0)