Add a / in the middle of string

Posted on 2014-08-13
Last Modified: 2014-08-13
I need to be able to insert a / in the middle of a string, so this 125674567 ends up like this 12/567/4567.

I am using SQL Server 2005.
I have used the SUBSTRING Function to display this, as below:
    SUBSTRING(Holding, 1, 2) + '/' +
    SUBSTRING(Holding, 3, 3) + '/' +
    SUBSTRING(Holding, 6, 11)
      FROM TagOrder_Import_RawData

How would I be able to update the records in the table?

Any help would be appreciated
Question by:Morpheus7
    LVL 65

    Accepted Solution

    Unless I'm missing something here...
    UPDATE TagOrder_Import_RawData
    SET Holding = 
        SUBSTRING(Holding, 1, 2) + '/' +
        SUBSTRING(Holding, 3, 3) + '/' +
        SUBSTRING(Holding, 6, 11) 

    Open in new window

    Disclaimer:  HOLY GOD MAKE A BACKUP FIRST, and you can't sue me if this goes wrong.

    Author Closing Comment

    Many thanks

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
    Introduction In my previous article ( I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now