Results 1 to 8 of 8

Thread: intser HTML into SQL Server

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2008
    Posts
    321

    intser HTML into SQL Server

    Hi All

    Im trying to insert HTML text into a fiel in my table on SQL Server 2005. I then call the string in the tablle via ADO.NET

    However, when i copy and paste the following into my field within my table it truncates the text. any ideas on how I can sucessfuly ass the following text int my table?

    thanks

    Code:
    <P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; FONT-SIZE: 10pt">Dear<?xml:namespace prefix = o ns = "“““urn:schemas-microsoft-com:office:office”““" /><o:p></o:p></SPAN></P>
    <P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
    
    <P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><B><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-fareast-language: EN-GB; mso-no-proof: yes">Kind Regards<o:p></o:p></SPAN></B></P>
    
    <P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><B><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-fareast-language: EN-GB; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></B></P>
    
    <P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><B><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-fareast-language: EN-GB; mso-no-proof: yes">Shamal Samal<o:p></o:p></SPAN></B></P>
    
    <P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><B><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-fareast-language: EN-GB; mso-no-proof: yes">Accounts Manager<o:p></o:p></SPAN></B></P>
    
    <P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-fareast-language: EN-GB; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
    
    <P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-fareast-language: EN-GB; mso-no-proof: yes">Tel: + 44 (0)207 100 1919<BR>Fax: +44 (0)203 393 3777<BR><A href="http://www.capitalvisas.com/"><SPAN style="COLOR: blue">www.capitalvisas.com</SPAN></A><o:p></o:p></SPAN></P>
    
    <P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-fareast-language: EN-GB; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
    
    <P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-fareast-language: EN-GB; mso-no-proof: yes">Capital Visas Ltd is authorised and regulated by the Office of the Services of Immigration Commissioner(OISC)<o:p></o:p></SPAN></P>
    
    <P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-fareast-language: EN-GB; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
    
    <SPAN style="FONT-FAMILY: Webdings; COLOR: green; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-fareast-language: EN-GB; mso-no-proof: yes; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-GB; mso-bidi-language: AR-SA">ü</SPAN><SPAN style="FONT-FAMILY: 'Ocean Sans MT Light'; COLOR: green; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-fareast-language: EN-GB; mso-no-proof: yes; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-GB; mso-bidi-language: AR-SA"> </SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: green; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-fareast-language: EN-GB; mso-no-proof: yes; mso-ansi-language: EN-GB; mso-bidi-language: AR-SA">Think of the environment - do you really need to print this e-mail?</SPAN><SPAN style="FONT-FAMILY: 'Ocean Sans MT Light'; COLOR: green; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-fareast-language: EN-GB; mso-no-proof: yes; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-GB; mso-bidi-language: AR-SA"> </SPAN><SPAN style="FONT-FAMILY: Webdings; COLOR: green; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-fareast-language: EN-GB; mso-no-proof: yes; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-GB; mso-bidi-language: AR-SA">P</SPAN><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-fareast-language: EN-GB; mso-no-proof: yes; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-GB; mso-bidi-language: AR-SA"><BR>&nbsp;<BR></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-fareast-language: EN-GB; mso-no-proof: yes; mso-ansi-language: EN-GB; mso-bidi-language: AR-SA">Capital Visas Limited&nbsp;made the following annotations:<BR><BR>"This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."&nbsp;<BR><BR>Capital Visas Limited&nbsp;a ajouté le commentaire suivant:<BR><BR>Ce courrier et toute pièce jointe qu'il contient sont réservés au seul destinataire indiqué et peuvent renfermer des renseignements confidentiels et privilégiés. Si vous n'êtes pas le destinataire prévu, toute divulgation, duplication, utilisation ou distribution du courrier ou de toute pièce jointe est interdite. Si vous avez reçu cette communication par erreur, veuillez nous en aviser par courrier et détruire immédiatement le courrier et les pièces jointes. Merci.</SPAN>

  2. #2
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: intser HTML into SQL Server

    What do you mean it truncates the text? How long is the text? How did you define the field? Are you using SSMS to view the posted text, if so there is a limit as to how much text will be brought back from a field in that application.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2008
    Posts
    321

    Re: intser HTML into SQL Server

    Quote Originally Posted by GaryMazzone View Post
    What do you mean it truncates the text? How long is the text? How did you define the field? Are you using SSMS to view the posted text, if so there is a limit as to how much text will be brought back from a field in that application.
    When I simply copy and paste that peice of HTML into the field it cuts of at the </P> Section

  4. #4
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: intser HTML into SQL Server

    Again... So what is the field definded like? How do you know if is truncated? Do the insert statement report trucnation?
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2008
    Posts
    321

    Re: intser HTML into SQL Server

    Quote Originally Posted by GaryMazzone View Post
    Again... So what is the field definded like? How do you know if is truncated? Do the insert statement report trucnation?
    Hi

    The field is defined as nvarchar(MAX)

    I know its trucncated because when i copy and paste the text it only pastes a small proportion of it

    Code:
    <P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><?xml:namespace prefix = o ns = "‘‘‘‘urn:schemas-microsoft-com:office:office’’’’" /><o:p><FONT face=Calibri>&nbsp;</FONT></o:p></P><P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><o:p><FONT face=Calibri>&nbsp;</FONT></o:p></P><P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><SPAN style="mso-bookmark: _MailAutoSig"><B><SPAN style="COLOR: black; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-fareast-language: EN-GB; mso-no-proof: yes"><o:p><FONT face=Calibri>&nbsp;</FONT></o:p></SPAN></B></SPAN></P><P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><SPAN style="mso-bookmark: _MailAutoSig"><B><SPAN style="COLOR: black; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-fareast-language: EN-GB; mso-no-proof: yes"><o:p><FONT face=Calibri>&nbsp;</FONT></o:p></SPAN></B></SPAN></P>
    Only the above part is pasted into the field

  6. #6
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: intser HTML into SQL Server

    Again if using SSMS then there is a size limit on what is displayed in any text field. You do not get everything. displayed back.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  7. #7
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: intser HTML into SQL Server

    Same thing happens if you run a SELECT Query too... but you can increase the amount of data displayed in the return. From inside SMS, Tools -> Options... select Query Results -> SQL Server -> Results to Text -> Maximum number of characters displayed in each column. By default it's 256...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2008
    Posts
    321

    Re: intser HTML into SQL Server

    Hi

    Thanks guys.

Posting Permissions

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



Click Here to Expand Forum to Full Width