473,327 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Default date format for a DB2 instance

Hi all,

In Oracle and SQL server I have a date/time of 01/01/2005 13.24.54. If
I do a select using the date field with a criteria of 01/01/2005 it
will find it just fine. DB2 requires the selection criteria to be in
the format 2005-01-01-13.24.54.000000 or it will not find it.

Is there a configuration parameter that can be set in the DB2 instance
or if there is a pre-SQL command
(like Oracles Alter Session Set NLS_DATE_FORMAT=....)? How would one go
about doing this?

Thanks in advance.

Henry

Nov 12 '05 #1
2 8472
Ian
dbztax wrote:
Hi all,

In Oracle and SQL server I have a date/time of 01/01/2005 13.24.54. If
I do a select using the date field with a criteria of 01/01/2005 it
will find it just fine. DB2 requires the selection criteria to be in
the format 2005-01-01-13.24.54.000000 or it will not find it.

Is there a configuration parameter that can be set in the DB2 instance
or if there is a pre-SQL command
(like Oracles Alter Session Set NLS_DATE_FORMAT=....)? How would one go
about doing this?


select ... from table where date(timestamp) = '01/01/2005'

Nov 12 '05 #2
dbztax wrote:
Hi all,

In Oracle and SQL server I have a date/time of 01/01/2005 13.24.54. If
I do a select using the date field with a criteria of 01/01/2005 it
will find it just fine. DB2 requires the selection criteria to be in
the format 2005-01-01-13.24.54.000000 or it will not find it.


The reason is that a timestamp is conceptually a different thing than a
date. How should DB2 know that you want to find all the timestamps at your
date and not a specific one? To make that explicity, convert the timestamp
to a date and then do the comparison: SELECT ... FROM ... WHERE
DATE(<your-timestamp>) = '01/01/2005'

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Hector A | last post by:
Hi I'm trying to convert a string that already looks like a date to a date that I can use when I pass it from java to the database. I receive the date in format yyyy-mm-dd and I need it to be a...
8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
8
by: Ishbel Kargar | last post by:
Since upgrading from old laptop (Windows 98) to new laptop (Windows XP), my mail-merge letters are doing strange things with date formats. For instance, my reminder letter for lapsed subs carries...
1
by: Delatere | last post by:
Hello, can anabody help? in the following part i cannot pass de desired default value In the module of the mbd i declared: Global datum_Glo As String in a form (Dossier_FRM)i did
12
by: Rob Meade | last post by:
Hi all, Ok - I've come from a 1.1 background - and previously I've never had any problem with doing this: Response.Write (Session("MyDate").ToString("dd/MM/yyyy")) So, I might get this for...
5
by: mabond | last post by:
Hi Having trouble filling a datetime filed in SQL table with a value from an array. The original source is a comma-delimited text file where the date and time values are in two columns. I...
1
by: Tom | last post by:
I need to modify the default behavior of Date.ToString() on all pages of my ASP.Net (2.0) site. I don't need to localize my app (it's an intranet-only site), but I need to enforce a specific...
2
by: syntego | last post by:
We commonly use triggers to log changes to our main tables to historical log tables. In the trigger, we create a concatenated string of the old values by casting them as follows: ...
6
by: NH | last post by:
I want to allow users to enter dates in a text box in either the US "MM dd yy" format or the UK "dd MM yy" format. But how can I validate these dates? All the date functions e.g. ISdate,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.