Previous Topic

Next Topic

convtouni Command—Convert Character Data to Unicode

Permission required: System administrator.

The convtouni utility converts character data in a database to Unicode, which lets you conveniently transform data in local encoding to Unicode. The utility converts all columns of data type char to nchar, and data type varchar to nvarchar.

Note: Convtouni should be run on a database that has Unicode support enabled. To enable Unicode support on a non-Unicode database, run alterdb with the –n option. For details, see alterdb Command.

This utility creates an intermediate SQL script that contains appropriate alter table statements to be executed, and an execution script for executing the SQL commands on the database. This two-step process allows you to examine the SQL script.

To complete the conversion process, execute the execution script after running the convtouni utility. In automodify mode, the execution script is created in a temporary directory and executed immediately.

By default, all columns of all tables that have char or varchar columns are altered and modified. If you specify a table list then only those tables are altered if they have char or varchar columns.

The convtouni command has the following format:

convtouni dbname [-param_file=filename] | [[-uuser] [-P] [-Ggroupid] [-dest=dir]
[-sqlfile=filename] [-automodify] [-col=column [-col=column]...] [{tables ...}]]

Previous Topic

Next Topic

convtouni Examples

Given a database userdb with tables tab1, tab2, tab3, and tab4 with char and varchar columns, the following command creates statements to convert all columns of all tables to Unicode.

convtouni userdb

On UNIX, this command generates SQL script ctouout.sql and an executable script ctouexec.ing.

The following command on UNIX converts three columns in the tab1 table and all columns of tab2 table of the userdb database into Unicode. The sqlfile=myfile.sql and the executable script ctouexec.ing is generated in directory /users/ingres/myloc:

convtouni userdb -dest=/users/ingres/myloc sqlfile=myfile.sql -col=tab1.col1
-col=tab1.col2 col=tab1.col3 tab2

The following command immediately executes the above commands:

convtouni userdb -automodify -col=tab1.col1 –col=tab1.col2 –col=tab1.col3 tab2

The following command converts all columns of all tables, but only col1 and col2 of the tab1 table:

convtouni userdb –automodify –col=tab1.col1 –col=tab1.col2


© 2007 Ingres Corporation. All rights reserved.