Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Hi,I have a field that has digits...201005171999061219851231etc.. the current format is YEAR MONTH DATEbut I need it to be:2010-05-171999-06-121985-12-31how do i convert the output? Thanks,Amber
If it is varchar, you can remove the extra most inner convert()Or you can also use stuff() to insert the dash in between the number / stringsKH[spoiler]Time is always against us[/spoiler]
madhivanan
Premature Yak Congratulator
22864 Posts
Posted - 2010-07-02 : 02:54:17
You should always use proper DATETIME datatype and leave formation at front end applicationMadhivananFailing to plan is Planning to fail
Amber_Deslaurier
Starting Member
40 Posts
Posted - 2010-07-02 : 17:51:57
Thank you! Yes I did find out that you were right... I had to leave the conversion local... tried it on the server but had bytes errors or something..