I have the following cfquery
:
<cfquery name="CQuery" datasource="XX.X.X.XXX">
INSERT INTO DatabaseName
(PhoneNumber_vch,
Company_vch,
date_dt)
VALUES(#PhoneNumber#,
#Company#,
#Date# )
</cfquery>
There are null values in case Company name doesnt' exist and I believe becasue of that Iam getting the following error:
Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near ','.
The comma ,
pointed in the error message is after #Company#
field. Please let me know is it's because of null values and best approach to fix it?
The values in the PhoneNumber, company and Date are extracted from a XML SOAP response with proper usage of trim function as discussed in my previous post.
Thanks
cfqueryparam
is definitely the way to go. The cfsqltypes vary depending on the data types of your columns. For dates, usecf_sql_timestamp
when dealing with a date and time, orcf_sql_date
when dealing with a date only. – Mathura