Remove Commas from text field in Select statement

Remove Commas from text field in Select statement

Post by Dean Beckle » Sun, 16 Nov 2003 01:19:47



I'm trying to remove commas from a text in a select
statement.  It looks like this:

Account               Description

626900              Travel, Meals, & Entertainment    

How do I select the description field so the data returned
looks like this:

Travel Meals & Entertainment

Thanks,
Dean

 
 
 

Remove Commas from text field in Select statement

Post by Trey Walpol » Sun, 16 Nov 2003 01:27:08


select account, replace(Description, ',', '') as Description...


Quote:> I'm trying to remove commas from a text in a select
> statement.  It looks like this:

> Account               Description

> 626900              Travel, Meals, & Entertainment

> How do I select the description field so the data returned
> looks like this:

> Travel Meals & Entertainment

> Thanks,
> Dean


 
 
 

Remove Commas from text field in Select statement

Post by Dean Beckle » Sun, 16 Nov 2003 01:56:14


Trey,

Thanks...that did it...I knew this had to be easy!

Dean

 
 
 

Remove Commas from text field in Select statement

Post by Aaron Bertrand [MVP » Sun, 16 Nov 2003 02:05:54


Quote:> select account, replace(Description, ',', '') as Description...

Hmmm, based on the subject, I wouldn't have thought this was valid, since
REPLACE() can't be performed directly on a TEXT column.  I guess I was
assuming "text field" = TEXT column ... however the OP is exchanging TEXT
and VARCHAR freely.
 
 
 

Remove Commas from text field in Select statement

Post by Trey Walpol » Sun, 16 Nov 2003 05:28:11


if i'd been more observant, i guess i would have thought the same, but i
only read as far as "remove commas"  before i saw the example data and
figured it couldn't be a text column, but was just "text" <s>

OP?



Quote:> > select account, replace(Description, ',', '') as Description...

> Hmmm, based on the subject, I wouldn't have thought this was valid, since
> REPLACE() can't be performed directly on a TEXT column.  I guess I was
> assuming "text field" = TEXT column ... however the OP is exchanging TEXT
> and VARCHAR freely.

 
 
 

1. USING A FIELD FROM MAIN SELECT STATEMENT IN SUB SELECT STATEMENT

Using the query shown below, I would like to replace "GUITO DALCE" with the
current  row value of field `NOMS` from the main select statement.

SELECT `NOMS`,(SELECT SUM(`HEURES`) FROM [Sheet1$A1:L360] WHERE `NOMS` =
"GUITO DALCE") As `Total Hours Worked` FROM [Sheet1$A1:L360]

2. Need help on UPDATE SQL

3. Removing commas from field data

4. #table

5. Including a text field in a SELECT statement

6. Adding TimeStamp column

7. Removing Rich Text Formatting From Text Field

8. "two dimensional" primary key

9. How to get comma separated values using select statement

10. Comparing comma-delimited field against an IN() statement...?

11. Replacing Commas in text Field

12. Replacing Commas in text Field (fwd)

13. Select Text field into var type text