view raw
ajdeguzman ajdeguzman - 8 months ago 38
SQL Question

How to insert character in between a string in SQL Server 2008?

I need help in inserting a character inside a string, e.g.:

031613 05:39 AM

The output should be:

03/16/13 05:39 AM


You can use STUFF

DECLARE @String NVARCHAR(20) = '031613 05:39 AM'

SELECT STUFF(STUFF(@String,3,0,'/'),6,0,'/')