SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    May 2004
    Location
    canada
    Posts
    145
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MSSQL: dataType for description.

    Hi all,
    I need to store description about product. That could be one page long(for example: one word page). What dataType should I use in MSSQL.
    My company had similar project with Access. In Access they are using Memo filed.

    Could you please tell me what datatype should I use in MSSQL. I need your expert advice.
    Thanks in advance.
    rainbow11

  2. #2
    SitePoint Zealot fredmintah's Avatar
    Join Date
    Jun 2004
    Location
    Ghana
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rainbow,
    You can use binary data type and hopefully you'll achieve what you want. Just specify the number of bytes you want or like to use and there you go. You can also choose to use varbinary and you don't have to specify the number of bytes you want to use. Remember, bit patterns is up to 255 bytes.

  3. #3
    SitePoint Guru asterix's Avatar
    Join Date
    Jun 2003
    Posts
    847
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This depends on what the nature of the data is.

    Is it just plain text? Is it likely to always be less than 4000 characters? Is it the only descriptively long field you will need?
    Then use NVARCHAR(4000).

    If you will never need to store extended (unicode) characters, such as letters with European diacritics () then you can get away with using VARCHAR and you could store up to 8000 characters. But I really reccommend against this, especially if you will be migrating data from MS Access to MS SQL.

    Is it possible it will be more than 4000 Unicode characters? Will it stell be text? Use the nText datatype.

    Will you want to store more complex data, such as a picture and text?
    Use a user-defined data type.

    If you actually want to store a word document, then as fred says, you will need to use the "image" data type. It also stores a practically unlimited amount of data (2 GB). The binary type can store at most 8000 bytes.

    HTH

  4. #4
    SitePoint Zealot
    Join Date
    May 2004
    Location
    canada
    Posts
    145
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks asterix and fredmintah for reply my post.

    I'll go with asterix's advice. I am going to use VARCHAR dataType, because I don't need to store extended (unicode) characters.

    thanks again for answer.
    rainbow11


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •