Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Remove Character -- a comma from a number Expand / Collapse
Author
Message
Posted Friday, August 6, 2010 4:38 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Monday, April 11, 2011 12:49 AM
Points: 69, Visits: 179
Hi,

I have the following figure 5,000. When I use Isnumeric () on this it returns 1 which is true however when i use
SELECT CONVERT(decimal, '5,000') I get an error saying Error converting data type varchar to numeric.

I have come to see that the , between 5 and 000 is the problem. Could you assist on removing this character ?

Regards,
Post #964987
Posted Friday, August 6, 2010 4:53 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 7:56 AM
Points: 2,372, Visits: 7,560
SELECT CONVERT(decimal, REPLACE('5,000',',','')) 




Not a DBA, just trying to learn

For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/

For better, quicker answers on SQL Server performance related questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/



If you litter your database queries with nolock query hints, are you aware of the side effects?
Try reading a few of these links...

(*) Missing rows with nolock
(*) Allocation order scans with nolock
(*) Consistency issues with nolock
(*) Transient Corruption Errors in SQL Server error log caused by nolock
(*) Dirty reads, read errors, reading rows twice and missing rows with nolock


LinkedIn | Blog coming soon (for sufficiently large values of "soon" )!
Post #964999
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse