Forum Discussion
Reading Float data with float variable in stored procedure rounds numbers
Hi,
In managemnet studio
Displays in messages window an actually assings to variable 178457
Why is rounding values to 7 length numeric data?
Thanks,
Manolis Perrakis
SQL Server Management Studio 19.3.4.0
SQL Server Management Objects (SMO) 16.200.48053.0+08fe64c9e8eb5ff3c7ea5787f145e9ecb3d57df8
Microsoft T-SQL Parser 17.0.27.0+b6df00d03710e3fafcbe827aad08bdbe9d45d1ab
Microsoft Analysis Services Client Tools 16.0.20054.0
Microsoft Data Access Components (MDAC) 10.0.22621.3958
Microsoft MSXML 3.0 6.0
Microsoft .NET Framework 4.0.30319.42000
Operating System 10.0.22631
1 Reply
- rodgerkongIron Contributor
When you use PRINT to diplay a float expressions, it will use Implicit conversions rules to convert a float expressions to varchar, just like the result that use CAST like this sample.
DECLARE @a float SET @a = 178457.05 SELECT CAST(@a AS varchar(20))SSMS query result window use other rules to format output, so it looks different.