Saving Formatted text to SQL field

  • I am wondering if it is possile to save text to an SQL tabnle field. If not how would i go about saving notes that are formatted to be used in access forms and reports.

  • You might want to be more specific.  Things like tabs, line feeds, carriage returns will save.   What other types of things are you looking for? 

    I wasn't born stupid - I had to study.

  • I am looking at like font, color, bold, Italic, Underline, bullets to save with the text

  • Kevin,

    You are not being very clear; it seems like you are asking if SQL can store strings?  I mean, it's obvious that SQL will store strings, I'm sure you know that, so I'm having trouble figuring out exactly what you mean.

    Are you asking if it can store strings greater than 8000 characters?  The answer to that is yes...it can store them in a "text" field.  depending on the column collation, tabs and carriage returns will be stored just fine.

    Now, if you are asking if you can FORMAT SQL Strings, the answer is no.  What you think of as formatting is generally done with meta tags, like in HTML.  These meta tags are read by the client (the web browser, in the HTML example), which uses them to format the string before displaying it.  So if meta tags can be stored as text (like XML or HTML) then you can simply store the raw text in a "Text" field.  If the format is not text, but some other funky or proprietary way, then it's not going to be this simple.

    I store HTML directly in the database sometimes, when I want to have "thin-client" jsp or asp pages.

    If you viewed the text below in a web browser, you would see that is is formated as bold.

    ------------------------------------------------------

    if object_ID('tempdb..#Test') is not null drop table #Test

    create table #Test (Name varchar(255), HTM varchar(255))

    Insert #Test values ('TrivialExample', '<HTML><BODY><B>Making Text Bold</B></BODY></HTML>')

    select * from #Test

     

    Signature is NULL

  • When you store data in a text column, SQL Server will not interpret this data in any way. This is the job of your front-end, in your case Access. So, when you want to store font data or any other formatting data you will need to insert this in such a way that Access is able to recognize it when it retrieves the information.

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

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

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