Linked SQL Server Query

  • Goal: I want to return some data from a linked sql server

  • Query: select top 10 * from [linkedServer].[database].[schema].[table]

I've simplified this drastically for ease of understanding.

I am trying to run a SQL query that accesses a linked server. My resource (database_a) has a linked server of (server_1) in SQL and in MSSQL, my query works fine and returns the top 10 rows.

In Retool, I want to run my query using my 'database_a' resource and access data inside 'server_1' to pull back some data. I do not get an error but I do get no results returned, even though data is returned when running the same thing in a SQL manager.

I was curious if this is something Retool does not allow, or if this is something that needs special attention further than I am attempting

Hello!

I have a linked server query that works using the format you provided in your Query statement between two SQL servers so you case should be working (I can get the data I expect to return). I also have a linked server setup in the same environment to an Oracle DB offsite which we must use OPENQUERY to access.

If you are linking to a resource that may be configured oddly, there might be a similar constraint when making the linked request from a SQL Server.

Hello! Yes I was able to find that OPENQUERY (and my query above) work just fine in a Workflow environment, but in an 'App' environment within a SQL Object, it doesn't work. Maybe a bug?

Hi @dohrann,

Sorry to hear you're running into issues with your query. Would you mind sharing screenshots of the query and/or a video of the behavior? Thanks!