Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
nikkihital22
Frequent Visitor

SQl Stored proc in Powerbi Error

Microsoft SQL: Cannot process the object "exec HumanResources..GetTempEmployeeHours_PowerBi"12/1/2023","1/19/2023" ". The OLE DB provider "MSOLEDBSQL" for linked server "(null)" indicates that either the object has no columns or the current user does not have permissions on that object.
Details:
DataSourceKind=SQL
DataSourcePath=sqlt4costagedw;HumanResources
Message=Cannot process the object "exec HumanResources..GetTempEmployeeHours_PowerBi"12/1/2023","1/19/2023" ". The OLE DB provider "MSOLEDBSQL" for linked server "(null)" indicates that either the object has no columns or the current user does not have permissions on that object.
ErrorCode=-2146232060
Number=7357
Class=16
State=1

 

--Syntax used ----

let

Source =Sql.Database("SQLT4COSTAGEDW", "HumanResources", [Query="SELECT * FROM #(lf)OPENROWSET('SQLNCLI','trusted_connection=yes', 'exec HumanResources..GetTempEmployeeHours_PowerBi"""&Date.ToText(@StartDate) & """,""" &Date.ToText(@EndDate) & """ ')", CreateNavigationProperties=false])

 

in
Source

Getting This error Using the admin account which has all the permissions 

3 REPLIES 3
Fowmy
Super User
Super User

@nikkihital22 

Could you try this please?

let
    Source = Sql.Database(
        "SQLT4COSTAGEDW", 
        "HumanResources", 
        [
            Query = "exec HumanResources..GetTempEmployeeHours_PowerBi '" & Date.ToText(@StartDate) & "','" & Date.ToText(@EndDate) & "'",
            CreateNavigationProperties = false
        ]
    )
in
    Source

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Was able to pull data : getting this error after apply.

nikkihital22_0-1705770214267.png

 

@nikkihital22 

I creted a simple SP in my SQL Server and called it with start and end date parameters as follows, you may apply the same in yours:

My SP:

CREATE PROCEDURE [dbo].[GetSalesByDateRange]
    @StartDate DATE,
    @EndDate DATE
AS
BEGIN
    -- Your SQL statements here
    SELECT ProductKey, [Order Date]
    FROM Sales
    WHERE  [Order Date] BETWEEN @StartDate AND @EndDate;
END;


I created two parameters in Power Query for start and end dates:

Fowmy_0-1705821195434.png

I connected to SQL with out any T-SQL at the start, just provided server and db then modified the M code as follows:

let
     Source = 
        Sql.Database( 
            ".", 
            "ContosoRetailDW_2019", 
            [
                Query = "EXEC GetSalesByDateRange @StartDate = '" & Text.From(#"@StartDate") & "' , @EndDate = '" & Text.From(#"@EndDate") & "'"
            ]
        )
    
in
   Source

 

The result:

Fowmy_1-1705821267035.png

 





Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors