Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Strip commas from string

Author  Topic 

Ken Blum
Constraint Violating Yak Guru

383 Posts

Posted - 2005-07-22 : 10:47:54
declare @str char(10)
SET @str = '1,000'
select convert(float,@str)


How can I strip the commas out of @str before calling convert?

TIA,

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2005-07-22 : 11:06:07
Look up the REPLACE function in BOL. Essentially you want to replace the comma with an empty string.

HTH

=================================================================
The most tyrannical of governments are those which make crimes of opinions, for everyone has an inalienable right to his thoughts. -Baruch Spinoza, philosopher (1632-1677)
Go to Top of Page

Ken Blum
Constraint Violating Yak Guru

383 Posts

Posted - 2005-07-22 : 11:17:17
How did I miss that?

Thanks!
Go to Top of Page
   

- Advertisement -