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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
IT_Solcius
New Member

Need Help with SQL Error

I keep getting this error but the stored procedure it is running is correct not sure what else I am missing. 

 

Error.png

4 REPLIES 4
AlexisOlson
Super User
Super User

My guess would be that this is ultimately a permissions-related error. Generally, Power Query only performs read-only operations on the database it's connecting to. However, the stored procedure you're attempting to use requires creating a table (not a read-only operation). Even if the user has database permission to create the relevant table, I'm not sure that Power Query allows it.

 

This is just a guess though. If anyone knows more definitively, please correct me.

Thank you it might be possible, but we also have a similar setup for another Excel file that functions correctly. I am not sure why it would do it for this one. 

Vijay_A_Verma
Super User
Super User

You can try to use fully qualified table name in your query like

SELECT TOP (10) * FROM [Sample].[dbo].[Sales]

If this still doesn't resolve your problem, can you give your complete SQL query?

I don't think so, because we aren't querying the table directly. We are using a stored procedure to create the table of data in Excel.

USE [Neil]
GO
/****** Object: StoredProcedure [dbo].[sp_jj_WIPExcludeArchived]  ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[sp_jj_WIPExcludeArchived]
@auditdate datetime
AS
BEGIN
SET NOCOUNT ON;
DROP TABLE IF EXISTS Neil.dbo.NS_WIP_DATA;
CREATE TABLE dbo.NS_WIP_DATA (
[Internal ID] float,
[Line ID] float,
[Project ID] float,
[Project Name] nvarchar(MAX),
[Date] datetime,
[Period] datetime,
[Type] nvarchar(MAX),
[Document Number] nvarchar(MAX),
[Status] nvarchar(MAX),
[Account ID] float,
[Account Number] float,
[Account Name] nvarchar(MAX),
[Account Type] nvarchar(MAX),
[Amount] float,
[Inspection Date] datetime,
[Cancel Date] datetime,
[Department ID] float,
[Department] nvarchar(MAX),
[Revenue Channel ID] float,
[Revenue Channel] nvarchar(MAX),
[Product Class ID] float,
[Product Class Name] nvarchar(MAX),
[Revenue Stream ID] float,
[Revenue Stream] nvarchar(MAX),
[Location ID] float,
[Location Name] nvarchar(MAX),
[Project Location ID] float,
[Project Location Name] nvarchar(MAX));
INSERT INTO NS_WIP_DATA Exec Neil.dbo.cp_NetSuiteWorkInProgress @auditdate;
DELETE FROM NS_WIP_DATA WHERE [Revenue Channel] = '700 - Third Party'
AND [Location ID] = '4';
SELECT
*
FROM
NS_WIP_DATA ns
JOIN (SELECT [Name] FROM SFV2Local..Project__c WHERE Archived__c = 'False') p ON ns.[Project Name] = p.[Name]
END

IT_Solcius_0-1652290028120.png

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors