Data Type for formatted text field

  • Hi All

    What data type would you use to insert formatted text and keep its formatting. Such as paragraphs and line breaks?

    Blaine

  • varchar/text (might need unicode but I doubt it)

  • Remi I was using varchar but it seems to concatenate the text? What do I use unicode?

  • UNicode is if you need some japanese characters or something like that. You'll hve to use text if you go over 8000 characters of data on a single line.

  • Use the TEXT datatype. Your front-end will have to do all the interpretation of such data.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Frank is correct!

    varchar and nvarchar are stored with (start & end pointers), for different stored lengths, but dont retain line returns and tabs...

    TEXT is stored similar to IMAGE, as "blob space" which retains all special characters such as in binary code...

    Like an FTP transfer (char versus binary)


    Regards,

    Coach James

  • WHAT (I know Frank is correct)?????????

    Declare @v-2 table (a varchar(100))

    Declare @Text as varchar(100)

    Set @Text = 'ARE ' + CHAR(10) + CHAR(13) + CHAR(9) + 'YOU' + CHAR(10) + CHAR(13) + CHAR(9) + CHAR(9) + 'SURE????'

    Insert into @v-2 (a) values (@Text)

    Select * from @v-2

  • Job security is doing a job which no one else can interpet or support; So most companies must throw out the work and start again...

    A Better method is to keep programming simple and direct, so it can be supported by the Greglorious's of the world...


    Regards,

    Coach James

  • Are you sure this is related to this post?

  • EXAMPLE:

    Using front-end application to update and maintain journal free formated text...

    Are suggesting that varchar be used with some kind of parser to retain returns and tabs?

    Or could it not be simplified in using TEXT as this is its purpose?


    Regards,

    Coach James

  • Text is just a longuer version of Varchar... the only question is the max expected size of the data, on which we have no information. So this is effectivly a moo(t) point.

  • http://www.sql-server-performance.com/datatypes.asp


    Regards,

    Coach James

  • Still a pointless debate.

    Use what you like and I'll keep using text datatype only when I need to, and it's still not known to be the case here. I've kept and still keep formatted text in varchar columns without a hitch.

    I consider this thread closed.

Viewing 13 posts - 1 through 12 (of 12 total)

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