Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Sign up nowGet Fabric certified for FREE! Don't miss your chance! Learn more
I need to use directquery to use parameter in slicer,
but my sql query is success in SQL SERVER but happen error when using direct query,
I have try to use -->select * from (.......my program......) as SourceQuery
still show error
"Microsoft SQL: Incorrect syntax near keyword 'declare'.
Incorrect syntax near ')'. "
I have so idea:(
I have the solution!
Convert your stored procedure to function that returns a table. It works!
Something like this:
create or alter function dbo.my_function()
returns @my_data table
(
Field1 varchar(20),
Field2 int,
Field3 int
)
as
begin
declare @test int
set @test = 1
insert into @my_data
select [Field1, Field2, Field3]
from [your table]
where Field3 = @test
return
end
@Lily36876 , You have to use select here. declare etc is not supported.
SP is supported, But not sure that can work direct query
thx For reply,that meas I can't use any declare in DQ?
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 61 | |
| 58 | |
| 42 | |
| 21 | |
| 18 |
| User | Count |
|---|---|
| 122 | |
| 118 | |
| 38 | |
| 36 | |
| 29 |