How can I insert a date into db2 in this format: yyyy-mm-dd
, using a sql query?
views:
35answers:
1
+1
A:
Consider a table:
CREATE TABLE tab (dt DATE);
Now insert a date into it as:
INSERT INTO tab VALUES ('2010-12-31');
Now on doing
SELECT * from tab;
we get:
DT
2010-12-31
codaddict
2010-10-04 07:14:21
Just to be clear: A date is a data type. How it is formatted by the application reading the date from the database may vary depending on what application you are using and the locale settings on the computer.
Ian Bjorhovde
2010-10-04 16:32:30