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.
I am using teh following in SP:Set @NewSequenceNO = @SequenceNO + 0.01for example the sequence numbers appear this way: 6.01 or 6.02 etcbut sometime this is happening:6.010004how to remove any numbers after tenth decimal position to make it appear 6.01Thank you very much for the helpful info.
Lamprey
Master Smack Fu Yak Hacker
4614 Posts
Posted - 2010-06-28 : 13:40:20
That is probably a front end/dispaly issue. But, there are several ways to do this. Here ae a couple:
DECLARE @Foo DECIMAL(20,10)SET @Foo = CAST('6.010004' AS DECIMAL(20,10))SELECT @Foo, CAST(@Foo AS DECIMAL(20, 2)), ROUND(@Foo, 2)
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts
Posted - 2010-06-28 : 19:01:41
Are you using float or real as the data type for @NewSequenceNO or @SequenceNO? If so, these are "approximate" data types which might be why you are getting strange results in the first place.=======================================A couple of months in the laboratory can save a couple of hours in the library. -Frank H. Westheimer, chemistry professor (1912-2007)