This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreGet Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.
I am not able to define the @DateFrom and @ DateTo parameters in this OPENQUERY that I am using as my connection to SQL Server:
SELECT *
FROM OPENQUERY ([HostName],
'EXEC databasename.dbo.stored_procedure_name
@DateFrom = CONVERT(DATETIME, ''2024-04-25''),
@DateTo = GETDATE(),
@Client_Id = NULL,
@ClientStatus = ''ACT'',
@InsurancePlan = ''1'',
@InsurancePlanStatus = ''ALL''');
I get this error: "Microsoft SQL: Statement(s) could not be prepared.
Incorrect syntax near the keyword 'CONVERT'."
Can someone please suggest the correct syntax for the @DateFrom and @DateTo parms?
Solved! Go to Solution.
@FarmerKenny , Try like , if the database is SQL Server, Azure SQL or the one uses T-SQL
SELECT *
FROM OPENQUERY ([HostName],
'EXEC databasename.dbo.stored_procedure_name
@DateFrom = CONVERT(DATETIME2(6), ''2024-04-25''),
@DateTo = CONVERT(DATETIME2(6),GETDATE() ),
@Client_Id = NULL,
@ClientStatus = ''ACT'',
@InsurancePlan = ''1'',
@InsurancePlanStatus = ''ALL''');
@FarmerKenny , Try like , if the database is SQL Server, Azure SQL or the one uses T-SQL
SELECT *
FROM OPENQUERY ([HostName],
'EXEC databasename.dbo.stored_procedure_name
@DateFrom = CONVERT(DATETIME2(6), ''2024-04-25''),
@DateTo = CONVERT(DATETIME2(6),GETDATE() ),
@Client_Id = NULL,
@ClientStatus = ''ACT'',
@InsurancePlan = ''1'',
@InsurancePlanStatus = ''ALL''');
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 21 | |
| 21 | |
| 21 | |
| 21 | |
| 16 |
| User | Count |
|---|---|
| 56 | |
| 53 | |
| 49 | |
| 26 | |
| 26 |