Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
how to convert float value into nvarchar
Posted

You need to convert Float to decimal and then to nvarchar.
e.g.
SQL
DECLARE @FltVal AS Float
SELECT @FltVal = 12345.67
SELECT CAST(CAST(@FltVal AS Decimal(8, 2)) AS NVarChar(20))
 
Share this answer
 
Use
SQL
Cast(<column> as nvarchar(50))
 
Share this answer
 
v2
Hi,

You can do it like this :
SQL
DECLARE @Text float
SET @Text = 1234.567
SELECT CONVERT(nvarchar(200), @Text) AS NvarcharValue

DECLARE @Text float
SET @Text = 1234.567
SELECT Cast(@Text as nvarchar(200)) AS FloatValue


Have a look at this link:
http://technet.microsoft.com/en-us/library/aa226054(v=sql.80).aspx[^]

Hope this helps !! :)

Regards,
Praneet Nadkar
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900