Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 decimal field to date format conversion

Author  Topic 

Ratz03
Starting Member

27 Posts

Posted - 2014-11-19 : 04:05:52
In the DB2 database, the date is stored as a packed numeric P 7.0, I need to convert it to the date format to reconcile the field in SQL .

DB2 Database date: 7 digits eg 1080401

Could anyone help me with the conversion.

Ratz03
Starting Member

27 Posts

Posted - 2014-11-19 : 11:11:58
Hi All,

I was able to crack it. Posting it here for the benefit of others.

CONVERT (DATETIME, CONVERT (VARCHAR(8), 'Datefield' + 19000000))
Go to Top of Page
   

- Advertisement -