Recent PostsRecent Posts Popular TopicsPopular Topics
 Home Search Members Calendar Who's On

 SET ROWCOUNT and table variable Rate Topic Display Mode Topic Options
Author
 Message
 Posted Wednesday, August 25, 2010 8:40 PM
 SSCrazy Group: General Forum Members Last Login: 2 days ago @ 6:53 AM Points: 2,393, Visits: 2,286
 Comments posted to this topic are about the item SET ROWCOUNT and table variable
Post #975310
 Posted Wednesday, August 25, 2010 8:51 PM
 SSCommitted Group: General Forum Members Last Login: Tuesday, April 01, 2014 2:53 PM Points: 1,676, Visits: 1,744
 This is an excellent question, thank you. I answered it correctly because for years I cannot find the answer to the following question: why would anyone ever consider casually using float data type? I understand that there might be some specific scenarios where the inaccuracy of calculations are not important and the range of the numbers is huge, but using float for no good reason is astonishingly bad not to say plain silly. The query in Qotd is one fine example demonstrating this point.Oleg
Post #975312
 Posted Wednesday, August 25, 2010 9:57 PM
 SSCrazy Group: General Forum Members Last Login: Thursday, March 27, 2014 8:50 AM Points: 2,163, Visits: 2,184
 Thanks for the question, I had to puzzle it out for a while, but got it right.
Post #975324
 Posted Wednesday, August 25, 2010 10:47 PM
 SSCommitted Group: General Forum Members Last Login: Wednesday, March 12, 2014 3:59 AM Points: 1,938, Visits: 1,149
 for testing folating point the same can be written asDECLARE @i float,@rc intset @i = 0while @i <> 1begin set @i = @i + 0.1endselect @ithen the loop never executes.I observer some intrested behavior of floating point DECLARE @i float,@rc intset @i = 0while @i <> 1begin set @i = 0.8999 + 0.1endselect @ithe above will never executes. we use 0.1 instead of 0.8999 other wise we can use 0.2,0.3,0.4,0.5,0.6,0.7,0.8.but when i added 0.9 it executesand show 1 as answer. MalleswarareddyI.T.AnalystMCITP(70-451)
Post #975345
 Posted Wednesday, August 25, 2010 10:54 PM
 SSCarpal Tunnel Group: General Forum Members Last Login: Thursday, April 10, 2014 5:08 AM Points: 4,999, Visits: 368
 The answer was almost obvious from the "do not run it on production server" recommendation.But, a good question for highlighting the pitfalls of "float". Cheers,- Mark
Post #975349
 Posted Wednesday, August 25, 2010 11:42 PM
 Hall of Fame Group: General Forum Members Last Login: 2 days ago @ 6:40 AM Points: 3,683, Visits: 4,818
 The only possible use for the float datatype that I have found is in the calculations used in astro-physics, where the distance between stars and galaxies is an approximation, at best ____________________________________________Space, the final frontier? not any more...All limits henceforth are self-imposed.“libera tute vulgaris ex”
Post #975366
 Posted Thursday, August 26, 2010 12:32 AM
 SSC-Insane Group: General Forum Members Last Login: Today @ 9:30 PM Points: 20,467, Visits: 14,104
 Thanks for a great question. Jason AKA CirqueDeSQLeilI have given a name to my pain...MCM SQL ServerSQL RNNRPosting Performance Based Questions - Gail ShawPosting Data Etiquette - Jeff ModenHidden RBAR - Jeff ModenVLFs and the Tran Log - Kimberly Tripp
Post #975384
 Posted Thursday, August 26, 2010 1:03 AM
 SSChampion Group: General Forum Members Last Login: Today @ 4:35 AM Points: 12,208, Visits: 9,172
 Great question. I got it wrong though. I do not really understand how the scope of the type variable works. It seems you can define it over and over again, without an error being thrown? How to post forum questions.Need an answer? No, you need a question.What’s the deal with Excel & SSIS?Member of LinkedIn. My blog at LessThanDot. MCSA SQL Server 2012 - MCSE Business Intelligence
Post #975393
 Posted Thursday, August 26, 2010 1:03 AM
 SSCommitted Group: General Forum Members Last Login: Thursday, April 10, 2014 1:38 AM Points: 1,615, Visits: 446
 Very interesting question and great explanations. Thanks
Post #975394
 Posted Thursday, August 26, 2010 1:33 AM
 SSC-Enthusiastic Group: General Forum Members Last Login: Tuesday, February 25, 2014 7:04 PM Points: 176, Visits: 563
 isn't it possible to use approximation if one is not specific of the exact value of the approximation, like "less than" and "greater than" ?
Post #975405

 Permissions