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 2000 Forums
 Transact-SQL (2000)
 Date convertion

Author  Topic 

WoodHouse
Posting Yak Master

211 Posts

Posted - 2010-07-14 : 04:43:10
Hi

I have data like this 14072010. i need to convert

14/07/2010 or 2010/07/14 datetime format


help on this..

thanks a lot

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-07-14 : 04:48:47
Is the date stored as integer or varchar right now?



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-07-14 : 04:49:39
SELECT STUFF(STUFF(Col1, 3, 0, '/'), 6, 0, '/')



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-07-14 : 04:56:44
Hi Peso,
that's fine.
I've never had the idea to use STUFF() with a length of zero to have a string-insert.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

WoodHouse
Posting Yak Master

211 Posts

Posted - 2010-07-14 : 05:05:42
Hi peso

Its Varchar field



Go to Top of Page

ramecepa
Starting Member

43 Posts

Posted - 2010-07-14 : 05:59:55
Hi
Convert(varchar(10),fieldname,103)----dd/mm/yyyy
SELECT convert(datetime, '2016/10/23', 111) -- yyyy/mm/dd
Go to Top of Page
   

- Advertisement -