Home:ALL Converter>Connecting to an SQL Server User Defined Function from Excel

Connecting to an SQL Server User Defined Function from Excel

Ask Time:2012-01-31T01:55:57         Author:Moof

Json Formatter

I have created an Inline Table-Value User Defined Function in SQL Server

I would like to input the parameters in various cells in an Excel spreadsheet, and have a table that will update with the results from those parameters when I enter them.

Normally, I do this with Microsoft Query, but that doesn't allow me to call a User Defined Function. So how do I go about creating an odc file, or otherwise connecting to that function?

I am using Excel 2010 and SQL Server 2008

Author:Moof,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/9068417/connecting-to-an-sql-server-user-defined-function-from-excel
FistOfFury :

I'm having this same problem. You need to use VBA and ADO to call the function with parameters via a SQL query.\n\nThis link shows how to make the call for a scalar function. \n\nA table value function would be similar, but you'd have to return the data as an array/matrix to call it directly from an Excel cell. Alternatively you can follow the directions here to use .CopyFromREcordset() and put the results into a worksheet.",
2012-06-14T14:46:19
yy