Q
Problem solve Get help with specific problems with your technologies, process and projects.

Inserting and retrieving dates in the dd/mm/yyyy HH24:mi:ss format

How do you insert or retrieve dates in the format dd/mm/yyyy HH24:mi:ss in SQL Server? Actually, I'm migrating a product from Oracle to SQL Server. The Convert function in SQL Server doesn't have a style like this and this is needed urgently. They have other styles, but I want this particular one.

To retrieve, roll your own format:

 select convert(varchar(50), getdate(),103)+' '+convert(varchar(50), getdate(),14)
To insert just ensure the DATEFORMAT is set correctly:
 create table #datetest ( datevalue datetime' ) SET DATEFORMAT DMY insert #datetest(datevalue) values('29/08/2002 21:20:03:787')

 

For More Information

Dig Deeper on Microsoft SQL Server Installation

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close