Inquiry about table design

  • Hi All,
    I have a table which is supposed to save in one of it's field, huge amount of text data like a document.
    The current table design for this column is ntext which according to my knowledge will be obsolete in next versions of SQL Server plus it currently doesn't support many operations, for example i cannot put it in the include column of an index.
    I hope you send me some suggestions for that, one of the ideas i thought about is making it varchar(8000) and checking if size of data to save is bigger than that size then divide on one or more rows to accommodate for saving the whole data.
    Also if i am going to apply previous solution i will need to do some kind of script to handle historical data.
    Regards
    Nader

  • nadersam - Sunday, December 2, 2018 11:42 PM

    Hi All,
    I have a table which is supposed to save in one of it's field, huge amount of text data like a document.
    The current table design for this column is ntext which according to my knowledge will be obsolete in next versions of SQL Server plus it currently doesn't support many operations, for example i cannot put it in the include column of an index.
    I hope you send me some suggestions for that, one of the ideas i thought about is making it varchar(8000) and checking if size of data to save is bigger than that size then divide on one or more rows to accommodate for saving the whole data.
    Also if i am going to apply previous solution i will need to do some kind of script to handle historical data.
    Regards
    Nader

    Have you thought of using varchar(MAX) or nvarchar(MAX)?

  • Jonathan AC Roberts - Monday, December 3, 2018 3:33 AM

    nadersam - Sunday, December 2, 2018 11:42 PM

    Hi All,
    I have a table which is supposed to save in one of it's field, huge amount of text data like a document.
    The current table design for this column is ntext which according to my knowledge will be obsolete in next versions of SQL Server plus it currently doesn't support many operations, for example i cannot put it in the include column of an index.
    I hope you send me some suggestions for that, one of the ideas i thought about is making it varchar(8000) and checking if size of data to save is bigger than that size then divide on one or more rows to accommodate for saving the whole data.
    Also if i am going to apply previous solution i will need to do some kind of script to handle historical data.
    Regards
    Nader

    Have you thought of using varchar(MAX) or nvarchar(MAX)?

    Yes this is one of the solutions i thought of also, the only thing i have against this , is that varchar(max) fields also cannot be added to include columns of an index which will cause a key lookup with any select but i guess that's better than having to divide a record over multiple rows if using standard varchar.

  • You could consider the use of a filestream.

    ...

  • HappyGeek - Monday, December 3, 2018 5:25 AM

    You could consider the use of a filestream.

    Thank you for your reply.
    Do you mean save a file to disk and just put in table the file path?

  • nadersam - Monday, December 3, 2018 5:37 AM

    HappyGeek - Monday, December 3, 2018 5:25 AM

    You could consider the use of a filestream.

    Thank you for your reply.
    Do you mean save a file to disk and just put in table the file path?

    Essentially yes Google SQL filestream, I can't supply a link by mobile! The other method I have used is to save the unc path with file extension in the DB and stored everything on a file server.

    ...

Viewing 6 posts - 1 through 5 (of 5 total)

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