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
 Hall of Fame Group: General Forum Members Last Login: Monday, November 28, 2016 1:13 AM Points: 3,367, Visits: 3,190
 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: Yesterday @ 5:05 AM Points: 1,683, Visits: 1,800
 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: Tuesday, June 30, 2015 9:47 AM Points: 2,160, Visits: 2,204
 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, July 29, 2015 11:50 PM Points: 1,967, Visits: 1,189
 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
 SSCertifiable Group: General Forum Members Last Login: Sunday, August 21, 2016 6:04 PM Points: 5,464, Visits: 440
 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
 SSCertifiable Group: General Forum Members Last Login: Yesterday @ 9:44 PM Points: 5,356, Visits: 7,064
 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: Monday, November 21, 2016 11:03 AM Points: 20,009, Visits: 18,255
 Thanks for a great question. Jason AKA CirqueDeSQLeilI have given a name to my pain...MCM SQL Server, MVPSQL RNNRPosting Performance Based Questions - Gail Shaw
Post #975384
 Posted Thursday, August 26, 2010 1:03 AM
 SSCoach Group: General Forum Members Last Login: Today @ 6:23 AM Points: 15,499, Visits: 13,162
 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 SQLKover. MCSA SQL Server 2012 - MCSE Business Intelligence
Post #975393
 Posted Thursday, August 26, 2010 1:03 AM
 SSCrazy Group: General Forum Members Last Login: Thursday, November 24, 2016 1:31 AM Points: 2,581, Visits: 621
 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: Monday, August 18, 2014 4:04 AM Points: 176, Visits: 567
 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