Solved

Tsql Statement

Posted on 2013-01-16
4
297 Views
Last Modified: 2013-01-17
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
Comment
Question by:Tech315
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 40

Expert Comment

by:lcohan
ID: 38783013
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
 

Author Comment

by:Tech315
ID: 38783037
I was thinking of how do you replace everything with in the { } in one shot
0
 
LVL 40

Accepted Solution

by:
lcohan earned 450 total points
ID: 38783054
"
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
 

Author Closing Comment

by:Tech315
ID: 38788593
Thank You
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how the fundamental information of how to create a table.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question