Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting date on an INSERT

Status
Not open for further replies.

TomBarrand

Programmer
Aug 9, 2000
162
GB
I need to format a date into dd/mm/yyyy format when I am inserting it into the database. I am using the statement below, but this is not correct.

Any ideas?

INSERT INTO FOB (Purch_Ord_Line_No, Tracker_No, FOB_Date) Values ( 999,1,CONVERT(DATETIME, '31/12/2002', 102)

Thanks
 
This is not a general database question. Its different in every dbms. Are you using Oracle, SQL Server or?
 
I am using SQL Server 2000. I also need to know the syntax for Informix too.

Thanks
 
TRY following code for SQL Server

INSERT INTO FOB (Purch_Ord_Line_No, Tracker_No, FOB_Date) Values ( 999,1,CONVERT(DATETIME, '31/12/2002', 103)

TRY following code for Oracle

INSERT INTO FOB (Purch_Ord_Line_No, Tracker_No, FOB_Date) Values ( 999,1,to_date('31/12/2002','dd/mm/rrrr'))
 
I need to know the syntax for SQL Server and Informix.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top