tranvangiang17
asked on
How to write a SQL Statement which can convert a 8-Char “TEXT” Field into a ”DATETIME” Field.
Please help me to write a SQL SERVER 2005 statement which can convert a 8-Char “TEXT” Field into”DATETIME” Field.
To simplify the issue; say my SQL DB has a single table called “TestTbl;” and this ‘TestTbl” has only one 8-Char text field, namely “DATE” with the data (3 records) as follows:
DATE (originally as 8-Char Text)
20111017
20110830
20110725
The requested query statement will give the output after its execution as follows:
DATE (now is simple "datetime" field)
10/17/2011
0-8/30/2011
07/25/2011
Thanks.
van
To simplify the issue; say my SQL DB has a single table called “TestTbl;” and this ‘TestTbl” has only one 8-Char text field, namely “DATE” with the data (3 records) as follows:
DATE (originally as 8-Char Text)
20111017
20110830
20110725
The requested query statement will give the output after its execution as follows:
DATE (now is simple "datetime" field)
10/17/2011
0-8/30/2011
07/25/2011
Thanks.
van
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dear mwvisa1,
It is working just fine. You are my hero.
Thanks.
Van
It is working just fine. You are my hero.
Thanks.
Van
ASKER
Output Data should read as follows instead:
DATE (now is simple "datetime" field)
10/17/2011
08/30/2011
07/25/2011
Thanks.