How to design

  • I have problem about how to design table to keep the document version

    I want to let the user to edit some document online and allow them to see their previous version of the document and compare between two version

    How can I minimize the size of data to be kept in the column instead of keep the whole text in every row?

    I hope it'll be something like subtraction for being stored in table and resume to the actual content

    Any suggestion

    Thanks in advance

  • Depending on the types of documents being edited you could store the original copy of a file in a table. Then in another table contain records that only store the differences. When the user edits their document and saves the changes you run a comparison between their new version and the original then store that information in the "Changes" table with a version number.

    When the user opens a document and selects the version they want to view your application could take the original document then apply the differences for that version before displaying it to the user.

    Actually maybe three tables would be best.

    Table 1: "Documents" - To contain the original version of the document.

    Table 2: "Version Header" - Information about a revision, Version Number, datetime of change, etc...

    Table 3: "Version Line" - Change detail, contains the actual changes to the document for a given version.

    If this is a text document the version line could hold the line number of a difference and the new information. You could make each version dependant on the one before it for storing the differences in an effort to reduce duplicate change data.

  • How are you showing the differences? Are these text files or richer (RTF/Word)?

    That might impact how to store the data.

  • Thank you Aster and Steve Jones,

    My document is MS Word document, so can I store the content in image or varbinary(max) datatype?

    I have another question, how can I compare the documents to see which line is changed.

    Thank you in advance again 🙂

  • Comparisons usually require a line by line marking and T-SQL isn't good at this.

    Word does this if you select the "Track Changes" menu item. This works pretty well and you might want to just use this, and track the saves in SQL Server.

  • To Steve Jones

    My application is online so every time user click save, I'd like to do comparision in realtime.

    I use ASP.NET to develop.

    Is there any way to do that?

    Thank you very much 🙂

  • I know there are ways to run comparisons on Word documents, but I personally haven't played around with it. You may want to spend some quality time with your favorite search engine, I have seen ActiveX examples, but the only things I see on a quick glance are making a totaly new document, not exactly what you were after.

  • Thank you very much for your helpfullness, Aster.

    I'll find out it 😀

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply