Subject | Alter column and character set |
---|---|
Author | rsaegerde |
Post date | 2002-07-31T08:31:02Z |
Hi,
from the LANGREF.PDF:
...
SET NAMES
Specifies an active character set to use for subsequent database
attachments.
Available in SQL, and isql.
...
Given a table with a column XY VARCHAR(50) CHARACTER SET WIN1252.
I want to change the column size to 60 in a script:
SET NAMES WIN1252; /* <-- !!! */
CONNECT 'myserver:d:\db\mydb.gdb' USER 'SYSDBA' PASSWORD 'masterkey';
SET AUTODDL OFF;
ALTER TABLE TBL1 ALTER COLUMN XY TYPE VARCHAR(60);
...
Following the explanation from LANGREF.PDF above, I'd expect the
column will change to lenght 60 and the character set stays WIN1252.
But it is wrong, the character set of the column is after that none.
I have to explicitly set the character set in the statement to get
what I want:
ALTER TABLE TBL1 ALTER COLUMN XY TYPE VARCHAR(60) CHARACTER SET
WIN1252;
I have SET NAMES WIN1252 before CONNECT to the database, it should
not be necessary to set it again in every statement. Anyway, it works
as expected in statements like CREATE TABLE ...
Am I missing anything, or is it a "feature"?
Regards
Richard
from the LANGREF.PDF:
...
SET NAMES
Specifies an active character set to use for subsequent database
attachments.
Available in SQL, and isql.
...
Given a table with a column XY VARCHAR(50) CHARACTER SET WIN1252.
I want to change the column size to 60 in a script:
SET NAMES WIN1252; /* <-- !!! */
CONNECT 'myserver:d:\db\mydb.gdb' USER 'SYSDBA' PASSWORD 'masterkey';
SET AUTODDL OFF;
ALTER TABLE TBL1 ALTER COLUMN XY TYPE VARCHAR(60);
...
Following the explanation from LANGREF.PDF above, I'd expect the
column will change to lenght 60 and the character set stays WIN1252.
But it is wrong, the character set of the column is after that none.
I have to explicitly set the character set in the statement to get
what I want:
ALTER TABLE TBL1 ALTER COLUMN XY TYPE VARCHAR(60) CHARACTER SET
WIN1252;
I have SET NAMES WIN1252 before CONNECT to the database, it should
not be necessary to set it again in every statement. Anyway, it works
as expected in statements like CREATE TABLE ...
Am I missing anything, or is it a "feature"?
Regards
Richard