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 2005 Forums
 Transact-SQL (2005)
 calculation problem.

Author  Topic 

jeff06
Posting Yak Master

166 Posts

Posted - 2010-09-09 : 16:58:59

Why @b*10=0? in following code.

I want to get 4.


declare @b decimal;
select @b=0.4;

select @b*10;

Thanks,
Jeff

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-09 : 17:06:24
It's because you didn't provide a size for decimal.

Try decimal(4, 2) or whatever makes sense for your data.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -