How to pass a dynamic query to source server from databricks

Rajani
Contributor II

I have this usecase wherein i am supposed to pass a dynamic query to get data from source I have tried the query option but its giving error 
SparkConnectGrpcException: (com.microsoft.sqlserver.jdbc.SQLServerException) Incorrect syntax near the keyword 'exec'.
I have tried executing same query in sql server and it works fine.Does anyone know how can i acheive it?

i have also tried the prepare_query option and tried to pass two queries it was helpful when i was passing cte but not when a dynamic query is created.

can anyone help?

#jdbc#databricks#dynamicQuery

 

Rajani
Contributor II

Hi  
thanks for your reply,
I have used foreign catalouge to fetch required data from information schema  then i am creating the dynamic query in databricks and then passing in query this is working for me! 



@Retired_mod

View solution in original post