|
The USER special register is defined as Varchar(18) so I would guesshttps://archive.midrange.com/midrange-l.
anything that uses the User would also need to be varchar(18).
From SQL Reference...
USER
The USER special register specifies the run-time authorization ID at
the current server. The data type of the special register is
VARCHAR(18).
Paul
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of
Glenn Gundermann
Sent: Thursday, October 12, 2017 2:48 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Subject: Why does USER require VARCHAR and not work with CHAR?
Hi there,
IBM i 7.3, TR 2, cum level 17061, DB2 PTF group level 6
I have a CREATE TABLE statement where the create user column is using
CHAR(18) and the change user column won't allow CHAR(18) but works if
VARCHAR(18).
Why can't they both be CHAR(18)?
This won't work:
CREATE OR REPLACE TABLE glenn_test_table FOR SYSTEM NAME test_table (
create_user FOR COLUMN recrtuser CHAR(18) CCSID 37 NOT NULL DEFAULT
USER ,
change_user FOR COLUMN rechguser CHAR(18) CCSID 37 NOT NULL
GENERATED ALWAYS AS (USER) )
RCDFMT RPCMMNT
SQL0574 Column, sequence, or variable attribute is not valid.
This does work:
CREATE OR REPLACE TABLE glenn_test_table FOR SYSTEM NAME test_table (
create_user FOR COLUMN recrtuser CHAR(18) CCSID 37 NOT NULL DEFAULT
USER ,
change_user FOR COLUMN rechguser VARCHAR(18) CCSID 37 NOT NULL
GENERATED ALWAYS AS (USER) )
RCDFMT RPCMMNT
My question, why?
Yours truly,
Glenn Gundermann
Email: glenn.gundermann@xxxxxxxxx
Work: (905) 486-1162 x 239
Cell: (416) 317-3144
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
--
Please contact support@xxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link:
http://amzn.to/2dEadiD
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.