本课假定您已完成前面的所有课程。 请参见第 1 课:创建并配置统一数据库。
在本课中,您将在 customer 表中添加新列来存储客户的手机号码。
使用连接到统一数据库的 Interactive SQL 实例执行以下 SQL 语句,以便在 customer 表中插入行。
ALTER TABLE customer ADD cell_phone VARCHAR(12) DEFAULT NULL; |
创建一个名为 my_ver2 的新版脚本,用于处理新模式远程数据库的同步。旧模式的远程数据库将继续使用旧版脚本 my_ver1。
对统一数据库执行以下 SQL 语句:
CALL ml_add_column('my_ver2', 'customer', 'id', null ); CALL ml_add_column('my_ver2', 'customer', 'name', null ); CALL ml_add_column('my_ver2', 'customer', 'phone', null ); CALL ml_add_column('my_ver2', 'customer', 'cell_phone', null ); CALL ml_add_table_script( 'my_ver2', 'customer', 'upload_insert', 'INSERT INTO customer ( id, name, phone, cell_phone ) ' || 'VALUES ({ml r.id}, {ml r.name}, {ml r.phone}, {ml r.cell_phone})' ); CALL ml_add_table_script( 'my_ver2', 'customer', 'download_cursor', 'SELECT id, name, phone, cell_phone from customer' ); CALL ml_add_table_script( 'my_ver2', 'customer', 'download_delete_cursor', '--{ml_ignore}' ); COMMIT; |
![]() |
使用DocCommentXchange讨论此页。
|
版权 © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |