× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



That should be the case for the noted SQL INSERT statement, or for a similar SQL UPDATE statement to the same TABLE using SET USER_ID = CURRENT CLIENT_USERID. The literal value specified in 'MYUSERID' should then appear as the value of the USER_ID column in the inserted or updated row.

However... Because SQL provides casting and truncation warnings, the application would not _require_ having a column fully supporting VARCHAR(255). However to accept every possible value, the length of 255 characters is the minimum, and since the client data is likely ASCII\UNICODE, the clause CCSID 1200 should also be added to designate the UTF16 character encoding. Note that CHAR(255) is also acceptable, but varying length is a better choice if\since the values would generally be shorter than the full 255 allowed; even better to use the ALLOCATE clause, to match [as best-fit] the likely average length for the literals that will be specified as the CLIENT USERID.

For example, consistent with that for the INSERT:

CREATE MYTABLE
( USER_ID VARCHAR(255) ALLOCATE(15) CCSID 1200
/* allocate presumes 15 char average Client_UserID values */
, COLUM1 VARCHAR(10) /* etc. ... */
, COLUM2 VARCHAR /* etc. ... */
)

Regards, Chuck

Ashish Kulkarni wrote:

Thanks for the information, so if I want to use CLIENT_USERID to update or insert data in table to keep track of who updated the row, I can have a statement

insert into MYTABLE (USER_ID, COLUM1, COLUM2)
values (CURRENT CLIENT_USERID, 'DATA1', DATA2');

and user_id column will be populated with the user it set in
*as400JDBCConn.setClientInfo("ClientUser", "MYUSERID");*

Columns USER_ID should be of length 255 VARCHAR to support this
insert


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.