Forum Discussion

BuketP's avatar
BuketP
New Contributor
11 months ago

Attachment copy over

Hi, 

Is there anyone who succeded copying attachment files one period to another period ? There is a getdataattachment function, however I don´t see setdataattachment. 

Thanks in advance 

Buket

  • RobbSalzmann's avatar
    RobbSalzmann
    Valued Contributor II

    Here's an example that would copy all the attachments in Jan 2011 to Feb 2011:

    INSERT INTO DataAttachment (
        [UniqueID],
        [Cube],
        [Entity],
        [Parent],
        [Cons],
        [Scenario],
        [Time],
        [Account],
        [Flow],
        [Origin],
        [IC],
        [UD1],
        [UD2],
        [UD3],
        [UD4],
        [UD5],
        [UD6],
        [UD7],
        [UD8],
        [Title],
        [AttachmentType],
        [CreatedUserName],
        [CreatedTimestamp],
        [LastEditedUserName],
        [LastEditedTimestamp],
        [Text],
        [FileName],
        [FileBytes]
    )
    SELECT
        NEWID() AS [UniqueID], 
        [Cube],
        [Entity],
        [Parent],
        [Cons],
        [Scenario],
        '2011M2' AS [Time], -- Set Time to whatever period you want
        [Account],
        [Flow],
        [Origin],
        [IC],
        [UD1],
        [UD2],
        [UD3],
        [UD4],
        [UD5],
        [UD6],
        [UD7],
        [UD8],
        [Title],
        [AttachmentType],
        [CreatedUserName],
        [CreatedTimestamp],
        [LastEditedUserName],
        [LastEditedTimestamp],
        [Text],
        [FileName],
        [FileBytes]
    FROM
        DataAttachment
    WHERE
        [Time] = '2011M1';

     

    • BuketP's avatar
      BuketP
      New Contributor

      Thank you RobbSalzmann, 

      I will give it a try.

      BR

      Buket

      Br

      Buket 

       

       

  • RobbSalzmann's avatar
    RobbSalzmann
    Valued Contributor II

    Hi BuketP, the information is in the DataAttachment Table.  It looks like you could write a query to do this, get the records with the attachments you want to copy, change the value in the time column and insert.  That should do it.