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
 SQL Server Development (2000)
 separator char in float field

Author  Topic 

lucasql
Starting Member

4 Posts

Posted - 2002-10-21 : 05:11:34
Hi, I have this problem:

I would insert in a float field a value with . like separator
for example:
Now I insert in my field 10.2
I would insert 10,2
How can i do?
thank you


Crespo

85 Posts

Posted - 2002-10-21 : 06:34:32
quote:

Hi, I have this problem:

I would insert in a float field a value with . like separator
for example:
Now I insert in my field 10.2
I would insert 10,2
How can i do?
thank you



O.K I am not sure if I understand what you mean, but how about you use the REPLACE function.

REPLACE('234,67', ',', '.')

So, original value = 234,67
after the REPLACE you should have 234.67

Is that what you want? If not, please be more specific with your question.

Best Regards.

Crespo.
Hewitt Bacon & Woodrow
Epsom
Surrey
United Kingdom
Go to Top of Page

lucasql
Starting Member

4 Posts

Posted - 2002-10-21 : 06:37:34
Thank you for your answer.
I know that I could use replace... but in this project is better that I don't use replace

thank you
by by
luca

Go to Top of Page

Crespo

85 Posts

Posted - 2002-10-21 : 09:26:15
quote:

Thank you for your answer.
I know that I could use replace... but in this project is better that I don't use replace

thank you
by by
luca





OK... how about you use the following :


Example,

DECLARE @NUMBER VARCHAR(50)
SET @NUMBER = '1236587,254'

SELECT @NUMBER

SELECT SUBSTRING(@NUMBER, 1, CHARINDEX(',' , @NUMBER)-1)+'.'+
SUBSTRING(@NUMBER, CHARINDEX(',' , @NUMBER)+1, LEN(@NUMBER)- CHARINDEX(',' , @NUMBER))


Hope this helps.

Best Regards.

Crespo.
Hewitt Bacon & Woodrow
Epsom
Surrey
United Kingdom
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2002-10-21 : 10:37:01
I know some countries use "," as a decimal seperator instead of "." with the "thousands" seperator reversed...


if this is the case for you, you should look into your regional/server settings....


it's a display property, not a storage issue....


Go to Top of Page
   

- Advertisement -