Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert a decimal value to SQL Money format

Status
Not open for further replies.

khue

Programmer
Mar 6, 2001
112
US
I'm having trouble converting a decimal value into SQL Server 2000 money format.

Convert(money(19,4), '#FORM.LOCAmt#')

Before it worked fine SQL Server 7, but ever since I have installed the new SQL Server 2000 and restored all the databases and tables accordingly, all the ColdFusion web pages that interfaces into SQL Server 2000 that are creating/modify this field are having this problem (this first sentence above.)

This is the original code:

<CFQUERY NAME=&quot;qryRefundCredit&quot; DBNAME=&quot;#Application.DSN3#&quot; DBTYPE=&quot;ODBC&quot; DATASOURCE=&quot;#Application.DSN3#&quot;>
INSERT INTO dbo.RefundCredit
(RegistrationID,
Refund_Or_Credit,
RefundCredit_Amt,
RefundCredit_Date,
Reason,
Comments,
UserID,
UserName,
Method_Of_Refund,
PaymentID,
AccountCode,
CourseID,
SectionID,
TrialID
)
values ('#FORM.RID#',
<CFIF FORM.Type EQ &quot;D&quot;>
'C',
<CFELSE>
'R',
</CFIF>
Convert(money(19,4), '#FORM.LOCAmt#'),
'#TODAYS_DATE#',
'#FORM.Reasons#',
<CFIF FORM.Comments NEQ &quot;&quot;>
'#FORM.Comments#',
<CFELSE>
NULL,
</CFIF>
'#SESSION.PERSON_ID#',
'#SESSION.FIRST_NAME# #SESSION.LAST_NAME#',
NULL,
NULL,
'#FORM.AccountCode#',
'#FORM.CID#',
'#FORM.SID#',
'#FORM.TID#'
)
</CFQUERY>

Does SQL Server 2000 have a new syntax? If not, can someone help me find out why this is happening?

Thanks for your help.
 
Try leaving out the 19,4; the money (and smallmoney and int and smallint, etc) formats have a fixed, inherent size, and the size is not normally specified for those datatypes. -----------------
Robert Bradley
use coupon code &quot;TEKTIPS&quot; for 15% off at:
 
foxdev,

I've tried what you have suggested and it worked. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top