MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » July 2014

Re: SQL table edit code questions



fixed

On 01-Jul-2014 19:35 -0500, Jack Tucky wrote:

I've been using SQL more in my daily work. I'm working with my first
table defined using SQL.

Since I have users who like to use Query/400, Is there an equivalent
to the EDTCDE DDS keyword that I can use maybe via ALTER TABLE?

Data /editing/ for presentation is the domain of the Report Writer; the Structured Query Language (SQL) is more about getting the [raw] data to the program. Edited data is not the original data type, and thus is an effective casting; i.e. the SQL would return either the original [raw] data, or that original data since cast into the data type documented by whatever is the chosen casting\scalar function. The DB2 for i SQL has not, and [per still have not] probably will not :-( provide an EDTWRD or EDTCDE scalar function; the SQL standards have added some Date and Timestamp editing casting scalars, and those are supported and documented with the DB2 for i SQL.

I also have a timestamp field in this table, is there a way to
define a separate date and time field as well?

Just as TIMESTAMP is the type keyword to define a timestamp data-type: DATE is the SQL type keyword to define a date data-type, and TIME is the SQL type keyword to define a time data-type.

I see iDate and an mcpress article for an edit code UDF from Bruce
Vining, but will they work with Query?

<http://www.mcpressonline.com/programming/apis/the-api-corner-dynamically-editing-a-numeric-value.html >


The Query/400 will be able to process a VIEW that encapsulates the specification of the scalar User Defined Function (UDF) against the column. The Query/400 only supports its own [built-in] specific set of SQL-like scalar functions; no SQL scalars nor any SQL UDF scalars can be specified directly [neither in the Define Result Fields nor Record Selection specifications]. Of course, the Query/400 report writer will only see the casted-to data type for that column of the VIEW rather than the original data type, thus will be unable to apply any of its supported numeric-only editing features.






Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot 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 here. If you have questions about this, please contact