"Statement(s) could not be prepared" error in SSIS using a UDF

6

I have a data flow task in SSIS '08, with an OLEDB data source. The query is this:

SELECT DISTINCT
    dbo.udf_CreateCCISSentenceDuration(probation_year, probation_month, probation_day)
FROM sentence

I pared down the query just to make this more readable. I get the following error regardless:

Error at 11012 DATA [Data Records [27]]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred.
Error code: 0x80040E14
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80040E14
Description: "Statement(s) could not be prepared.".
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80040E14
Description: "Cannot find either column "dbo" or the user-defined function or aggreate
"dbo.udf_CreateCCISSentenceDuration", or the name is ambiguous.".

This query works fine in SSMS. If I remove the "dbo." owner part, I get "'udf_CreateCCISSentenceDuration' is not a recognized built-in function name.". The database I am running this against is a SQL 2005 instance. I've done searches, but can't find anything relating to this error and UDFs. Any help is greatly appreciated!

sql-server
ssis
asked on Stack Overflow Jan 25, 2013 by Gary

2 Answers

0

This probably isn't really an SSIS issue. To help determine if it is, try reproducing this error outside of SSIS to debug it by writing a stored proc with the same function call. In essence you'll need to store the stored proc on the server/database instance your oledb connection originates the request from.

If you get a similar error, do a 4 part refernce to the server, db, owner and finally function to see if that works (e.g. [myServerWhereFunctionIs].[myDatabaseInstanceWhereFunctionIs].[ownerSchemaOfFunction].udf_Function

answered on Stack Overflow Dec 4, 2013 by plditallo
-1

For me query is the problem for that error. After modifying my query it work fine. So please go through your query based on the description in the error message.

answered on Stack Overflow Jan 8, 2015 by Arulraj

User contributions licensed under CC BY-SA 3.0