Forum Discussion
Use SQL Store Procedure in Power BI
stangellapallyeferreiranirajdubeyasocorro As a follow up to my previous post, i was testing this further due to another thread, and have discovered that you don't need to change any database settings or use OpenQuery. If you wrap your stored procedure in a variable you can import the data using a sproc (Doesn't work in Direct Query, only import)
example:
DECLARE @sqlCommand varchar(1000)
SET @sqlCommand = 'dbo.Testproc'
EXEC (@sqlCommand)
Anonymous
I know this is an old post, but what's the use/benefit of using:
DECLARE @sqlCommand varchar(1000)
SET @sqlCommand = 'dbo.Testproc'
EXEC (@sqlCommand)
Opposed to a plain and simple:
EXEC STORED_PROCEDURE
- Anonymous7 years agoNot applicable
nirvana_moksh At the time of the previous post when you ran a stored procedure against the database in Direct Query mode it woud fail. This work around got it to work, I have not tested it in awhile, so I don't know if that behaviour has changed. If you use "import" then you can just use a straight execute statement.
- nirvana_moksh7 years agoImpactful Individual
Anonymous - thanks for the reply Seth!