We help IT Professionals succeed at work.
Get Started

Accessing SQL Server function passing parameters

DataQuery asked
Last Modified: 2015-10-04

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.

Watch Question
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE