Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Tsql Statement

Posted on 2013-01-16
4
Medium Priority
?
307 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 1800 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

618 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