Copy link to clipboard
Copied
I have a function in cfc file like following to call MS SQL server stored procedure.
The stored procedure check ID if ID exists then update table, if not then insert a new record.
<cffunction name="NewRecord" access="remote">
<cfargument name ="MyID" required="yes" default="1" hint="My ID">
<cfargument name ="MyText" required="no" default="" hint="MyText">
<cfstoredproc datasource="mydatasource" procedure = "mySP">
<cfprocparam value = "#MyID#" CFSQLTYPE = "cf_sql_integer">
<cfprocparam value = "#MyText#" CFSQLTYPE = "cf_sql_varchar">
</cfstoredproc>
</cffunction>
The insert works if the record does not exist from my click button on cfm file,
I run the stored procedure works from SSMS works on update and insert.
I got excute query error when the record exists in the table.
The update works if I provide integer value for the text field.
[Macromedia][SQLServer JDBC Driver][SQLServer]Conversion failed when converting the nvarchar value 'test' to data type int.
For some reason, cfc function consider mytext must use integer instead of text even I declare cf_sql_varchar, but insert works,
Any suggestins or information is great appreciated,
Regards,
Iccsi,
Copy link to clipboard
Copied
iccsi,
Can you post the *exact* code you used to call the CFC function?
-Carl V.
Copy link to clipboard
Copied
Thanks for the information and help,
I found that it is a bug in the stroed procedure,
Thanks again for helping,
Regards,
Iccsi,