tags:

views:

35

answers:

1

How can I insert a date into db2 in this format: yyyy-mm-dd, using a sql query?

+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
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