I have a user defined function in my MS SQL(2005) that I would like to execute through Coldfusion (8).
Any idea how I can get this to work?
[It’s not a stored procedure, so cfstoredproc is out] .
Thank you in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can call the SQL UDF right inside a regular CFQUERY block, assuming your Coldfusion datasource has appropriate EXECUTE permissions on the desired UDF. You don’t have to return a select statement inside of CFQuery. Remember to use CFQUERYPARAM for safety if you are passing any Coldfusion variables to the database.
To call the UDF, you need to include its schema*. In our case, we used the default schema, so our UDFs are prefixed with “dbo.” as in dbo.FunctionName().
Here is an example:
*If you don’t include the UDF’s schema, you will get an “Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver][SQLServer]'[FUNCTION NAME]’ is not a recognized built-in function name.” (CF 8)