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 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--Set Database Characteristics.
This utility creates the following files:
• An SQL script (ctouout.sql) that contains appropriate alter table statements to be executed
• An execution script (ctouexec.ing on UNIX and ctouexec.bat on Windows) for executing the SQL commands on the database
After running the convtouni utility, examine the SQL script and then execute the execution script.
When you run convtouni 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, only the listed 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 ...}]]
dbname
Specifies the name of the database to be exported.
-param_file=filename
Specifies the command file that contains the options to the convtouni command. If used, do not specify other options on the convtouni command. The file must contain all options and each parameter (dbname, table, user, and so on) must be on a separate line.
-uuser
Specifies the effective user for the session.
-P
Specifies the password if the session requires one.
-Ggroupid
Specifies the group ID of the user.
-dest=dir
Specifies the directory the output SQL file will be written to.
-sqlfile=filename
Specifies the name of the output SQL file.
-automodify
Modifies the tables immediately by creating the execution script in a temporary directory and executing it.
-col=column
Specifies the column to convert, in tablename.columnname format. Each column must be preceded by –col=. Only the specified columns are changed; the rest of the char and varchar columns remain unchanged.
Note: No more than 100 objects can be specified. This limit can be raised by modifying the utexe.def file. For more information, see the Database Administrator Guide.
tables
Specifies a list of tables to convert. If no list is specified, but the ‑col= option is, then all specified columns of all tables owned by the user are altered. However, for the tables specified on the –col= option, only the specified columns are converted to Unicode.
Note: No more than 100 objects can be specified. This limit can be raised by modifying the utexe.def file. For more information, see the Database Administrator Guide.