Solved

Tsql Statement

Posted on 2013-01-16
4
287 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
  • 2
  • 2
4 Comments
 
LVL 39

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 39

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now