Accessing SQL Server function passing parameters

DataQuery
DataQuery used Ask the Experts™
on
Hi

I'm wondering how standard it is to create a chart in SharePoint (perhaps via Excel services) that queries the data from a SQL Server user defined function (while passing parameters to said function).

From SSMS, it's as simple as
SELECT * FROM dbo.FunctionName(12345, '2015-01-01', '2016-01-01')
or, parameterised, something like:
SELECT * FROM dbo.FunctionName(@Param1, @Param2, @Param3)

The parameters need to be passed to the server request (either as dedicated parameters, or resolved into the SQL string and then passed).  Does this require some .NET extention on the SharePoint side or is it standard?
From Excel, you'd be able to set up an OLE connection, with a standard command text something like:
SELECT * FROM dbo.FunctionName(@Param1, @Param2, @Param3)
and pass the parameters from the spreadsheet at runtime.

Any input most welcome.

Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Is this an onsite SharePoint installation, or is it a hosted O365 instance?  It makes a difference.


The easiest and most straight forward way to do this is to

{step 1} forget about SharePoint and build the solution in Excel using OLAP or oData connections within Excel.  

Then {step 2} Once you have a working solution which queries the database and grabs the results (all within excel), you can then host the Excel document within SharePoint and use Excel Services and Excel Web Access Web Part to interactively display pages/tabs of the Excel document.

Author

Commented:
Interesting take.
Thanks, will pass it on.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial