RE: T-SQL division drops the decimal?
Joshua, I bump into this all the time. You said it is a numeric field but what is the definition of your numeric field. If it is something like numeric(5,0) then there are no decimal places for it to work with. Like Mark said, to get the fraction part just do it as 2.0 and T-SQL will to an implicit type conversion of all the numbers and return the fraction part. __ Bill Grover Supervisor MIS Phone: 301.424.3300 x3324 EU Services, Inc. FAX:301.424.3696 649 North Horners Lane E-Mail: [EMAIL PROTECTED] Rockville, MD 20850-1299WWW:http://www.euservices.com __ -Original Message- From: Joshua Miller [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 11:53 AM To: CF-Talk Subject: RE: T-SQL division drops the decimal? The division operator returns an INT according to the T-SQL reference. It also says that the division operator drops the remainder. The data comes from a NUMERIC field and I'm storing the value into a VARCHAR(10) field so that's not the problem, it just drops the remainder by default. I tried one using: newcolumn = '' +mycolumn/2+ '.' +mycolumn%2+ '' This gave me an error that VARCHAR data . cannot be converted to INT, however the field that it's being inserted into is a VARCHAR(10) field. I'll try some of the CAST() CONVERT() options, thanks. Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net [EMAIL PROTECTED] (704) 569-0801 ext. 254 ** ** * Any views expressed in this message are those of the individual sender, except where the sender states them to be the views of Garrison Enterprises Inc. This e-mail is intended only for the individual or entity to which it is addressed and contains information that is private and confidential. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error please delete it immediately and advise us by return e-mail to [EMAIL PROTECTED] ** ** * -Original Message- From: Craig Dudley [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 11:21 AM To: CF-Talk Subject: RE: T-SQL division drops the decimal? Silly question, but what datatype is the column which holds your result? Not forgotten about it and left it as an int have you? Even if not, I'd play with the datatypes a bit, it may be your issue. -Original Message- From: Joshua Miller [mailto:[EMAIL PROTECTED] Sent: 31 July 2003 16:15 To: CF-Talk Subject: T-SQL division drops the decimal? How do others on the list deal with this? I have a query that takes a value from the database and divides by 2 and inserts that value into another table, however SQL Server (T-SQL) drops the decimal place, so 1/2 of 1 is 0 according to T-SQL. Any idea how to overcome this? That seems really odd if I WANTED to round I could use FLOOR() or CEILING() to round, why make it the default in T-SQL Thanks, Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net http://www.garrisonenterprises.net/ [EMAIL PROTECTED] (704) 569-0801 ext. 254 ** ** * Any views expressed in this message are those of the individual sender, except where the sender states them to be the views of Garrison Enterprises Inc. This e-mail is intended only for the individual or entity to which it is addressed and contains information that is private and confidential. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error please delete it immediately and advise us by return e-mail to mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] ** ** * ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: T-SQL division drops the decimal?
The numeric field where the result is stored does make a difference, but the 2 is in your division is making the difference below. If you want a decimal result then you must divide by a decimal. I tried one using: newcolumn = '' +mycolumn/2+ '.' +mycolumn%2+ '' 0 = 1/2 / 2 1/4 = 1/2 / 2.0 Kevin Webb -Original Message- From: Bill Grover [mailto:[EMAIL PROTECTED] Sent: Friday, August 01, 2003 6:08 AM To: CF-Talk Subject: RE: T-SQL division drops the decimal? Joshua, I bump into this all the time. You said it is a numeric field but what is the definition of your numeric field. If it is something like numeric(5,0) then there are no decimal places for it to work with. Like Mark said, to get the fraction part just do it as 2.0 and T-SQL will to an implicit type conversion of all the numbers and return the fraction part. __ Bill Grover Supervisor MIS Phone: 301.424.3300 x3324 EU Services, Inc. FAX:301.424.3696 649 North Horners Lane E-Mail: [EMAIL PROTECTED] Rockville, MD 20850-1299WWW:http://www.euservices.com __ -Original Message- From: Joshua Miller [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 11:53 AM To: CF-Talk Subject: RE: T-SQL division drops the decimal? The division operator returns an INT according to the T-SQL reference. It also says that the division operator drops the remainder. The data comes from a NUMERIC field and I'm storing the value into a VARCHAR(10) field so that's not the problem, it just drops the remainder by default. I tried one using: newcolumn = '' +mycolumn/2+ '.' +mycolumn%2+ '' This gave me an error that VARCHAR data . cannot be converted to INT, however the field that it's being inserted into is a VARCHAR(10) field. I'll try some of the CAST() CONVERT() options, thanks. Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net [EMAIL PROTECTED] (704) 569-0801 ext. 254 ** ** * Any views expressed in this message are those of the individual sender, except where the sender states them to be the views of Garrison Enterprises Inc. This e-mail is intended only for the individual or entity to which it is addressed and contains information that is private and confidential. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error please delete it immediately and advise us by return e-mail to [EMAIL PROTECTED] ** ** * -Original Message- From: Craig Dudley [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 11:21 AM To: CF-Talk Subject: RE: T-SQL division drops the decimal? Silly question, but what datatype is the column which holds your result? Not forgotten about it and left it as an int have you? Even if not, I'd play with the datatypes a bit, it may be your issue. -Original Message- From: Joshua Miller [mailto:[EMAIL PROTECTED] Sent: 31 July 2003 16:15 To: CF-Talk Subject: T-SQL division drops the decimal? How do others on the list deal with this? I have a query that takes a value from the database and divides by 2 and inserts that value into another table, however SQL Server (T-SQL) drops the decimal place, so 1/2 of 1 is 0 according to T-SQL. Any idea how to overcome this? That seems really odd if I WANTED to round I could use FLOOR() or CEILING() to round, why make it the default in T-SQL Thanks, Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net http://www.garrisonenterprises.net/ [EMAIL PROTECTED] (704) 569-0801 ext. 254 ** ** * Any views expressed in this message are those of the individual sender, except where the sender states them to be the views of Garrison Enterprises Inc. This e-mail is intended only for the individual or entity to which it is addressed and contains information that is private and confidential. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error please delete it immediately and advise us by return e-mail to mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] ** ** * ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription
RE: T-SQL division drops the decimal?
It's the datatype of the column your holding your information in. Check the Docs for the correct datatype. -Original Message- From: Joshua Miller [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 11:15 AM To: CF-Talk Subject: T-SQL division drops the decimal? How do others on the list deal with this? I have a query that takes a value from the database and divides by 2 and inserts that value into another table, however SQL Server (T-SQL) drops the decimal place, so 1/2 of 1 is 0 according to T-SQL. Any idea how to overcome this? That seems really odd if I WANTED to round I could use FLOOR() or CEILING() to round, why make it the default in T-SQL Thanks, Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net http://www.garrisonenterprises.net/ [EMAIL PROTECTED] (704) 569-0801 ext. 254 * Any views expressed in this message are those of the individual sender, except where the sender states them to be the views of Garrison Enterprises Inc. This e-mail is intended only for the individual or entity to which it is addressed and contains information that is private and confidential. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error please delete it immediately and advise us by return e-mail to mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] * ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: T-SQL division drops the decimal?
Silly question, but what datatype is the column which holds your result? Not forgotten about it and left it as an int have you? Even if not, I'd play with the datatypes a bit, it may be your issue. -Original Message- From: Joshua Miller [mailto:[EMAIL PROTECTED] Sent: 31 July 2003 16:15 To: CF-Talk Subject: T-SQL division drops the decimal? How do others on the list deal with this? I have a query that takes a value from the database and divides by 2 and inserts that value into another table, however SQL Server (T-SQL) drops the decimal place, so 1/2 of 1 is 0 according to T-SQL. Any idea how to overcome this? That seems really odd if I WANTED to round I could use FLOOR() or CEILING() to round, why make it the default in T-SQL Thanks, Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net http://www.garrisonenterprises.net/ [EMAIL PROTECTED] (704) 569-0801 ext. 254 * Any views expressed in this message are those of the individual sender, except where the sender states them to be the views of Garrison Enterprises Inc. This e-mail is intended only for the individual or entity to which it is addressed and contains information that is private and confidential. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error please delete it immediately and advise us by return e-mail to mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] * ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: T-SQL division drops the decimal?
I think it depends on the datatypes you're using as inputs to the division calculation, if they are integers then it does have problems, you could try using: (CAST(myfield AS float))/(CAST(myfield2 AS float)) if myfield1 and myfield2 are integers Alex -Original Message- From: Joshua Miller [mailto:[EMAIL PROTECTED] Sent: 31 July 2003 16:15 To: CF-Talk Subject: T-SQL division drops the decimal? How do others on the list deal with this? I have a query that takes a value from the database and divides by 2 and inserts that value into another table, however SQL Server (T-SQL) drops the decimal place, so 1/2 of 1 is 0 according to T-SQL. Any idea how to overcome this? That seems really odd if I WANTED to round I could use FLOOR() or CEILING() to round, why make it the default in T-SQL Thanks, Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net http://www.garrisonenterprises.net/ [EMAIL PROTECTED] (704) 569-0801 ext. 254 ** ** * Any views expressed in this message are those of the individual sender, except where the sender states them to be the views of Garrison Enterprises Inc. This e-mail is intended only for the individual or entity to which it is addressed and contains information that is private and confidential. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error please delete it immediately and advise us by return e-mail to mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] ** ** * ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: T-SQL division drops the decimal?
Would it be because it's an integer? You may need to use CAST() or CONVERT(). Ade -Original Message- From: Joshua Miller [mailto:[EMAIL PROTECTED] Sent: 31 July 2003 16:15 To: CF-Talk Subject: T-SQL division drops the decimal? How do others on the list deal with this? I have a query that takes a value from the database and divides by 2 and inserts that value into another table, however SQL Server (T-SQL) drops the decimal place, so 1/2 of 1 is 0 according to T-SQL. Any idea how to overcome this? That seems really odd if I WANTED to round I could use FLOOR() or CEILING() to round, why make it the default in T-SQL Thanks, Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net http://www.garrisonenterprises.net/ [EMAIL PROTECTED] (704) 569-0801 ext. 254 * Any views expressed in this message are those of the individual sender, except where the sender states them to be the views of Garrison Enterprises Inc. This e-mail is intended only for the individual or entity to which it is addressed and contains information that is private and confidential. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error please delete it immediately and advise us by return e-mail to mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] * ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: T-SQL division drops the decimal?
Joshua, MS SQL automatically returns the type you use. Looks to me like you are dividing 2 integers. You need to cast or convert at least one of the numbers to float to get a float returned. This got to be such a pain for me that I wrote a function to do the division (MSSQL 2000). It converts both numbers to float and then checks for nulls and zero. If there is a null or zero I just return a 0.0 (due to the bus requirements here). If you want the functions, let me know. Steve -Original Message- From: Joshua Miller [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 11:15 AM To: CF-Talk Subject: T-SQL division drops the decimal? How do others on the list deal with this? I have a query that takes a value from the database and divides by 2 and inserts that value into another table, however SQL Server (T-SQL) drops the decimal place, so 1/2 of 1 is 0 according to T-SQL. Any idea how to overcome this? That seems really odd if I WANTED to round I could use FLOOR() or CEILING() to round, why make it the default in T-SQL Thanks, Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net http://www.garrisonenterprises.net/ [EMAIL PROTECTED] (704) 569-0801 ext. 254 * Any views expressed in this message are those of the individual sender, except where the sender states them to be the views of Garrison Enterprises Inc. This e-mail is intended only for the individual or entity to which it is addressed and contains information that is private and confidential. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error please delete it immediately and advise us by return e-mail to mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] * ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: T-SQL division drops the decimal?
I have a query that takes a value from the database and divides by 2 and inserts that value into another table, however SQL Server (T-SQL) drops the decimal place, so 1/2 of 1 is 0 according to T-SQL. you're telling sql server to divide 2 int, it returns what you asked of it, an int. i always either cast or more often simply: 1/2.0 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: T-SQL division drops the decimal?
The division operator returns an INT according to the T-SQL reference. It also says that the division operator drops the remainder. The data comes from a NUMERIC field and I'm storing the value into a VARCHAR(10) field so that's not the problem, it just drops the remainder by default. I tried one using: newcolumn = '' +mycolumn/2+ '.' +mycolumn%2+ '' This gave me an error that VARCHAR data . cannot be converted to INT, however the field that it's being inserted into is a VARCHAR(10) field. I'll try some of the CAST() CONVERT() options, thanks. Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net [EMAIL PROTECTED] (704) 569-0801 ext. 254 * Any views expressed in this message are those of the individual sender, except where the sender states them to be the views of Garrison Enterprises Inc. This e-mail is intended only for the individual or entity to which it is addressed and contains information that is private and confidential. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error please delete it immediately and advise us by return e-mail to [EMAIL PROTECTED] * -Original Message- From: Craig Dudley [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 11:21 AM To: CF-Talk Subject: RE: T-SQL division drops the decimal? Silly question, but what datatype is the column which holds your result? Not forgotten about it and left it as an int have you? Even if not, I'd play with the datatypes a bit, it may be your issue. -Original Message- From: Joshua Miller [mailto:[EMAIL PROTECTED] Sent: 31 July 2003 16:15 To: CF-Talk Subject: T-SQL division drops the decimal? How do others on the list deal with this? I have a query that takes a value from the database and divides by 2 and inserts that value into another table, however SQL Server (T-SQL) drops the decimal place, so 1/2 of 1 is 0 according to T-SQL. Any idea how to overcome this? That seems really odd if I WANTED to round I could use FLOOR() or CEILING() to round, why make it the default in T-SQL Thanks, Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net http://www.garrisonenterprises.net/ [EMAIL PROTECTED] (704) 569-0801 ext. 254 * Any views expressed in this message are those of the individual sender, except where the sender states them to be the views of Garrison Enterprises Inc. This e-mail is intended only for the individual or entity to which it is addressed and contains information that is private and confidential. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error please delete it immediately and advise us by return e-mail to mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] * ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: T-SQL division drops the decimal?
Thanks all for the help, this is what ended up working: icode=(CAST(tblDomReportData.rpoints AS float))/2 Very odd in my opinion, I would think that the math functions in T-SQL would be a bit more elegant than that. I suppose if T-SQL gets the value 4 irregardless of what datatype it is it always changes to INT when doing division. Bizarre. Thanks for the assistance! Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net [EMAIL PROTECTED] (704) 569-0801 ext. 254 * Any views expressed in this message are those of the individual sender, except where the sender states them to be the views of Garrison Enterprises Inc. This e-mail is intended only for the individual or entity to which it is addressed and contains information that is private and confidential. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error please delete it immediately and advise us by return e-mail to [EMAIL PROTECTED] * -Original Message- From: Paul Hastings [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 11:53 AM To: CF-Talk Subject: Re: T-SQL division drops the decimal? I have a query that takes a value from the database and divides by 2 and inserts that value into another table, however SQL Server (T-SQL) drops the decimal place, so 1/2 of 1 is 0 according to T-SQL. you're telling sql server to divide 2 int, it returns what you asked of it, an int. i always either cast or more often simply: 1/2.0 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: T-SQL division drops the decimal?
Actually it's acting the way I would expect, which is like a C compiler: If all of the numbers appear to be ints then it does integer math. If *any* of the numbers is a float then it does float math. Try this expression instead and see what you get: icode=tblDomReportData.rpoints/2.0 Since 2.0 looks like a float it will return a float. Mark -Original Message- From: Joshua Miller [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 12:04 PM To: CF-Talk Subject: RE: T-SQL division drops the decimal? Thanks all for the help, this is what ended up working: icode=(CAST(tblDomReportData.rpoints AS float))/2 Very odd in my opinion, I would think that the math functions in T-SQL would be a bit more elegant than that. I suppose if T-SQL gets the value 4 irregardless of what datatype it is it always changes to INT when doing division. Bizarre. Thanks for the assistance! Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net [EMAIL PROTECTED] (704) 569-0801 ext. 254 * Any views expressed in this message are those of the individual sender, except where the sender states them to be the views of Garrison Enterprises Inc. This e-mail is intended only for the individual or entity to which it is addressed and contains information that is private and confidential. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error please delete it immediately and advise us by return e-mail to [EMAIL PROTECTED] * -Original Message- From: Paul Hastings [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 11:53 AM To: CF-Talk Subject: Re: T-SQL division drops the decimal? I have a query that takes a value from the database and divides by 2 and inserts that value into another table, however SQL Server (T-SQL) drops the decimal place, so 1/2 of 1 is 0 according to T-SQL. you're telling sql server to divide 2 int, it returns what you asked of it, an int. i always either cast or more often simply: 1/2.0 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4