## help in my procedure

 Author Message Evil Kraig F SSC Guru Group: General Forum Members Points: 52943 Visits: 7660 CELKO (12/15/2010)=================DECLARE @mon1 MONEY, @mon2 MONEY, @mon3 MONEY, @mon4 MONEY, @num1 DECIMAL(19,4), @num2 DECIMAL(19,4), @num3 DECIMAL(19,4), @num4 DECIMAL(19,4); SELECT @mon1 = 100, @mon2 = 339, @mon3 = 10000, @num1 = 100, @num2 = 339, @num3 = 10000 SET @mon4 = @mon1/@mon2*@mon3 SET @num4 = @num1/@num2*@num3 SELECT @mon4 AS moneyresult, @num4 AS numericresultOutput: 2949.0000 2949.8525The problem here isn't necessarily in the money type, but it's in the override that occurs.In particular, @Num1/@Num2 turns into either a float, or a decimal (20, 20)... leading me to assume the float.Expanding on your code above:`DECLARE@mon1 MONEY,@mon2 MONEY,@mon3 MONEY,@mon4 MONEY,@num1 DECIMAL(19,4),@num2 DECIMAL(19,4),@num3 DECIMAL(19,4),@num4 DECIMAL(19,4);SELECT@mon1 = 100, @mon2 = 339, @mon3 = 10000,@num1 = 100, @num2 = 339, @num3 = 10000SET @mon4 = @mon1/@mon2*@mon3SET @num4 = @num1/@num2*@num3SELECT @mon4 AS moneyresult,@num4 AS numericresultselect @mon1, @num1select @mon2, @num2select @mon3, @num3SELECT @mon1/@mon2, @Num1/@Num2SELECT CONVERT( DECIMAL( 19, 4), @Num1) / CONVERT( DECIMAL( 19, 4), @Num2)SELECT CONVERT( DECIMAL( 19, 4), @Num1 / @Num2)SELECT @Mon2*@Mon3, @Num2*@Mon3SELECT 0.2949*10000, 0.2949852507374631268 * 10000`In particular, the results from SELECT @mon1/@mon2, @Num1/@Num2 are incredibly disparate, which is causing the difference. The reconversion from the float into the correct # of significant digits also changes the resultant rounding, a known issue with float. It depends on what level of accuracy to what significance you want. - Craig FarrellNever stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake. For better assistance in answering your questions | Forum NetiquetteFor index/tuning help, follow these directions. |Tally TablesTwitter: @AnyWayDBA LutzM SSC Guru Group: General Forum Members Points: 56763 Visits: 13559 CELKO (12/15/2010)...ISO-11179 is big and hard to read. That is why I put it into English in my SQL PROGRAMMING STYLE book. The DoD and Feds are hot for it and it is showing up in contracts now. ... Really? You made DoD and Feds to include your book as one of their contract requirements??? That really makes it easy: If they require your book as a standard they either have to provide a copy of it or the price will be included in the quotation.I can assure you, this specific cost will be a single item all by itself... (including a nice and warm side note regarding a "wanna-be-standard").If the backlink from "it" to "your book" is a misinterpretation from my side, please replace it with "wanna-be-standard". LutzA pessimist is an optimist with experience. How to get fast answers to your question How to post performance related questionsLinks for Tally Table , Cross Tabs and Dynamic Cross Tabs , Delimited Split Function WayneS SSC-Forever Group: General Forum Members Points: 49672 Visits: 10851 CELKO (12/15/2010)>> There's math problems with money? Please, do tell. I haven't heard anything about them and as I use that field [sic: columns are not fields] quite a bit, I need to know. <> Now Microsoft may or may not have implemented COALESCE() by ANSI-Standards. I don't know. But given that no one can compare one unknown value (NULL) to another unknown value, I don't think using COALESCE() will help the OP. Especially since COALESCE returns NULL if all the expressions being evaluated are NULL. <> Dialect??? Not sure what you mean by that. Please explain. <> This [meta data affixes on data element name] is a personal preference issue. Using "T-" as a naming standards is at best annoying to type, but shouldn't cause any problems unless it's a reserved keyword issue that I'm unaware of.<<1) Violates ISO-11179 rules about data element namesI have to disagree with this one. Standards aren't standards unless everyone adopts them. You can call Blue Ray a standard if you want, it won't prevent people from buying DVD. Companies don't provide ISO rules to their programmers. Programmers aren't going to go out and buy standards books on their own. And where are the training classes? I used to work at a university that certified people in ISO standards via Conferences and other CTE classes. I can promise you that this standard was not one of them.CELKO (12/15/2010)2) Violates a basic rule of data modeling. Not sure what rule you're talking about. A lot of the books I've read specifically instruct people to name tables, views, procs and functions using an enterprise-wide standard that tells everyone what they're dealing with when they're coding. In fact, I think I remember reading a Kimball paper that said the same thing.CELKO (12/15/2010)3) Screws up your data dictionary;What's your definition of "data dictionary"? Mine is a report I wrote up that specifically lists tables, views, procs and functions in different areas of the report and then lists dependencies on each. I don't see how my data dictionary would be screwed up by something as simple as a name.CELKO (12/15/2010)4) In a language with only one data structure, it is redundant and looks as silly as putting "noun-" in front of every noun in an English sentence. It says that you are still writing BASIC, where the one-pass interpreter needed the \$ tell it this variable was string and not a float. Again, this is your personal preference, a statement of opinion, like the statement right before it. Nothing in this statement is scientific or logical. Reason 1 is the closest thing you have to an actual fact in your response. Reason 2 is skirting the line because it again depends on what books someone's been reading about data modeling. I can see both sides of the naming argument, but nothing about either side has any "proof" that the data (or reports) will get hosed if you go one way or another on the issue. That being the case, I stand by my opinion that naming conventions are a matter of choice and the only thing that can be wrong about them is if they aren't consistently implemented across the enterprise. Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle. Brandie Tarvin SSC Guru Group: General Forum Members Points: 92775 Visits: 9544 WayneS (12/15/2010)CELKO (12/15/2010)>> There's math problems with money? Please, do tell. I haven't heard anything about them and as I use that field [sic: columns are not fields] quite a bit, I need to know. <