• cfm - Monday, February 26, 2018 9:28 AM

    If I want the year and month I would need to add the right and left.  correct

    UPDATE [EC_StoreAttributes]

      SET AttributeValue = RIGHT(CONVERT(VARCHAR(10), GETDATE(), 101), 2) +
       SUBSTRING(AttributeValue, 3, LEN(AttributeValue) - 4) +
       left(CONVERT(VARCHAR(10), GETDATE(), 101), 2)

    WHERE
    AttributeType = 'ECSRCCODE' and StoreRecordId = '1'

    There are actually two different approaches that could be used.  You could start with the attribute and then add the year at the beginning and the month at the end or you could start with the year and month and insert the attribute in the middle.

    This second approach may not be as obvious to native English speakers, because English doesn't regularly use infixes (which is essentially what this approach mirrors).  The one case is called expletive insertion or f*ing insertion and is used to show emphasis.  Examples include abso-<expletive>-lutely and in-<expletive>-credible where an expletive is inserted in the words "absolutely" and "incredible" respectively.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA