Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 2 of 2

Thread: Removing word from product

  1. #1
    deanfp is offline Senior Member
    Join Date
    May 2009
    Location
    Sweden
    Posts
    556

    Default Removing word from product

    Hi

    I've ran this code that adds a "Buy One Get One Free" after each product for a supplier but does anyone know how to remove the words?

    update Product set Name = Name + ' (Buy One Get One Free)',
    SKU = SKU + 'Z'
    where ProductID in (select ProductID from ProductManufacturer
    where ManufacturerID = 28)

  2. #2
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default

    Well, you can try this script:
    Code:
    DECLARE @len int
    SET @len = LEN('(Buy One Get One Free)')
    SELECT @len
    UPDATE p SET p.[Name] = Name + SUBSTRING(Name, (@len+1), len(p.Name) - @len)
    FROM Product p
    WHERE p.Name like '%(Buy One Get One Free)'
    Please ensure a full-backup of your database prior to any change for safety...