Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
hiI tried executing the TSQL code but am getting zero when it should be 0.10. Why is it so? ThanksDeclare @Discount as decimal(18,2)Set @Discount = 10/100Select @Discount
khtan
In (Som, Ni, Yak)
17689 Posts
Posted - 2009-12-22 : 23:37:14
integer divide by integer will give you the result in integer
Declare @Discount as decimal(18,2)Set @Discount = 10.0/100Select @Discount
KH[spoiler]Time is always against us[/spoiler]
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts
Posted - 2009-12-23 : 00:32:51
This too will solve your issueDeclare @Discount as decimal(18,2)Set @Discount = 10/100.0Select @DiscountSenthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/