Home > Ask the AS/400 Experts > DB2/400 and DB2 UDB Questions & Answers > Creating a date field using SQL
Ask The iSeries 400 Expert: Questions & Answers
EMAIL THIS

Creating a date field using SQL

Kent Milligan EXPERT RESPONSE FROM: Kent Milligan

Pose a Question
Other iSeries 400 Categories
Meet all iSeries 400 Experts
Become an Expert for this site


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


>
QUESTION POSED ON: 31 August 2004
I've created a table using SQL with a date field. I've used STRPDM to view the data in the date field and found the dates stored are yyyy-mm-dd. I also checked other files which were created from a DDS file and the format is mm/dd/yyyy. I would appreciate any information on this.


>
Previously ask question: I am trying to create a table using SQL. I would like the dates to be of the *USA (mm/dd/yyyy) format. All of our files have been created with DDS and all of our dates are DATFMT *USA. I would like to create some new files with SQL, but I can't get the dates in the format that we use. How can I do this?

The DATFMT cannot be specified on SQL Create Table. All date values, however, are stored by DB2 in the same internal format regardless of the DATFMT that is specified on the column or field definition. When that data is read from the SQL Table it will be converted to the output date format specified by the application -- in your case the *USA format.

The same answer that was given earlier also applies to your situation with STRPDM. Since STRPDM doesn't allow you to control the date format setting, DB2 displays with the date value on this interface with the default setting. With SQL tables the output default format is always ISO as dictated by the standards -- the default format for the DDS file would be derived from the date format specified in the field definition.

==================================
MORE INFORMATION ON THIS TOPIC
==================================

Check out this Search400.com Featured Topic: Database issues resolved

Search400.com's targeted search engine: Get relevant information on DB2/400.

The Best Web Links: Tips, tutorials and more.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
DB2/400 and DB2 UDB
When is the YES option for 'reuse deleted files' function the best choice?
Monitoring members 'stuck' within a physical file on an EDI system
Developing tables in a parent-child relationship in DB2
SQL server error message -321
Creating a host variable of the 'where in' statement in SQL
Choose which column names are returned via ODBC when working with DB2 files
Allow access to data from a stored procedure result set using COBOL or RPG
Access path and an open data path differences
Convert a numeric physical file to a character in SQL without leading zeros
Inserting data from a CTE into a file in SQL

DB2 UDB (universal databases)
Oracle boasts 11g on SPARC is faster than IBM DB2 on Power 595
When is the YES option for 'reuse deleted files' function the best choice?
Monitoring members 'stuck' within a physical file on an EDI system
Developing tables in a parent-child relationship in DB2
SQL server error message -321
Creating a host variable of the 'where in' statement in SQL
Choose which column names are returned via ODBC when working with DB2 files
Access path and an open data path differences
Database performance comparisons on IBM i
Implement variables in SQL when creating an alias
DB2 UDB (universal databases) Research

iSeries SQL commands and statements
Enhancing RPG with external SQL stored procedures
Tracking data changes on IBM i with triggers
Introduction to SQLRPGLE on IBM i: Making a report
Making the most of RPG data handling on IBM i
When is the YES option for 'reuse deleted files' function the best choice?
Monitoring members 'stuck' within a physical file on an EDI system
Creating a host variable of the 'where in' statement in SQL
SQL server error message -321
Choose which column names are returned via ODBC when working with DB2 files
Convert a numeric physical file to a character in SQL without leading zeros
iSeries SQL commands and statements Research

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



iSeries Networking - Printing, Remote Access, TCP/IP
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts