ajdeguzman ajdeguzman - 1 year ago 104
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

Answer Source

You can use STUFF

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

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


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download