Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pulling text into Excel from SQL text field with Collation

Status
Not open for further replies.

nicoh99

Programmer
Mar 16, 2009
17
0
0
US
Hello,

I have a text field(notes) in SQL Server that has the Collation set to <database default>. When I query the notes field I get the notes text along with the collation info.

{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 MS Shell Dlg 2;}}
\viewkind4\uc1\pard\lang1033\f0\fs17 test comments are here

I need to pull the notes into an Excel spreadsheet without all of the collation info (I want to end up with "test comments are here" from the above example), but haven't had much luck. I tried using the Mid function when getting the data over to excel to omit this data, but it is not consistently the same length throughout all of my records. I don't think a substring function in by SQL statement would work either because I the collation data doesn't always ends with "fs17". Is there a way to strip out the collation info in a SQL query? If not, is there a way to do this once I get the data into Excel/VBA code?
Any ideas for a solution would be appreciated.
Thanks,

Nic
 
That is NOT collation information. What you are seeing is Rich Text Formating information. This stuff can include fonts, colors, etc.....

I don't really know a good way to get rid of RTF formating, but rest assured, it is NOT collation information.


-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top