Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 310
  • Last Modified:

Tsql Statement

Morning, I'm in the process of doing a conversion and exporting data out of sql 2005 to a csv file. One of my fields have over a few thousand entries with uneeded characters. example

{\rtf1\ansi\deff0\deftab720{\fonttbl{\f0\fswiss MS Sans Serif;}{\f1\froman\fcharset2 Symbol;}{\f2\fswiss Tahoma;}{\f3\fswiss Tahoma;}}  {\colortbl\red0\green0\blue0;\red0\green0\blue255;\red0\green0\blue128;}  \deflang1033\pard\plain\f2\fs17   \par }

  thats just from one row is there a quick way to do it rather than use the replace statement with multiple replace? And how would I go about it?

Thanks
0
Tech315
Asked:
Tech315
  • 2
  • 2
1 Solution
 
lcohanDatabase AnalystCommented:
You could do that by using SQL REPLACE function if you really need to get rid of OR use BCP to export from SQL to txt or csv file for text columns data.
0
 
Tech315Author Commented:
I was thinking of how do you replace everything with in the { } in one shot
0
 
lcohanDatabase AnalystCommented:
"
I was thinking of how do you replace everything with in the { } in one shot
"


you mean the whole data in that column is useless? Sorry if I missed the point....if the string is always the same then REPLACE SQL function might be for you. if not....you need to work on pieces or use a PATINDEX to find the patern position you need to replace, and use a SUBSTRING with PATINDEX like in example below:

http://stackoverflow.com/questions/4685114/sql-server-2005-query-substring-patindex
http://stackoverflow.com/questions/1839643/sql-output-a-substring-based-on-a-search-pattern-ensuring-first-last-strings-a
0
 
Tech315Author Commented:
Thank You
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now