SQLServer 2005 - Change character in NVarChar

I receive some arguments into a stored procedure. These arguments are NVARCHAR's.

I have a problem, when I need to cast some of these values to FLOATS, because they are being received as e.g.

@VALUE1 NVARCHAR(100)

DECLARE @ChangedValue SET @ChangedValue = CAST(@Value1 AS FLOAT)

E.g. @Value1 = "0,001"

Gives me a problem, as it expects "0.001"

I can't change the format of the input, but can I somehow change it on the SQL-server side? By changing all "," to "." instead?

Best regards, Kenn

Answers


You could use @VALUE1 = REPLACE(@VALUE1, ',', '.')

This does seem a horrible thing to do though!


Need Your Help

Is there a way to connect Intellij IDEA to Sublime Text on Mac OS X?

osx intellij-idea sublimetext2

I would like to find a way to open a file in Sublime Text 2 from Intellij IDEA (on Mac OS X), as to use its advanced text editing features on those occasions where writing "normal text" is not enou...

mysql query to select between previous and next month

mysql sql datetime

Trying to select all days from the start of the previous month to the end of the next month:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.