Re: OPENQUERY causes "TinyTds::Error: Incorrect syntax near"

2020-07-10 Thread KING SABRI
That is super informative!! I tried both ways you mentioned and both work like a charm! *Thank you Tim!* On Friday, July 10, 2020 at 8:51:09 PM UTC+3, Tim Tilberg wrote: > > Ah, sorry. The correct option I was thinking of was `QUOTED_IDENTIFIER` > (not plural). > > There are a few other optio

Re: OPENQUERY causes "TinyTds::Error: Incorrect syntax near"

2020-07-10 Thread Tim Tilberg
Ah, sorry. The correct option I was thinking of was `QUOTED_IDENTIFIER` (not plural). There are a few other options you might want to set as well. I find them important for consistency between tools. If you are using a version of Sequel >= 5.23.0 (2019-08-01), you can pass `ansi: true` into t

Re: OPENQUERY causes "TinyTds::Error: Incorrect syntax near"

2020-07-10 Thread KING SABRI
Hi Tim Thank you for taking the time to response After your advice, I changed the quotes to square-brackets then I got a new error, as the following > TinyTds::Error: Heterogeneous queries require the ANSI_NULLS and > ANSI_WARNINGS options to be set for the connection. This ensures consisten

Re: OPENQUERY causes "TinyTds::Error: Incorrect syntax near"

2020-07-10 Thread Tim Tilberg
Try executing `SET QUOTED_IDENTIFIERS ON` before running this query. Recent versions of Sequel included the `ansi` connection option, which causes Sequel to behave more like most other clients -- this is one of the settings it affects. If this doesn't do the trick, SQL Server uses `[]` for iden

Re: OPENQUERY causes "TinyTds::Error: Incorrect syntax near"

2020-07-08 Thread KING SABRI
Thank you for your response In the official documentation, they are using a variable not an actual hostname. I tried to use the hostname *without* quotes on another SQL client and it returns "incorrect synatx" I also tried the same query on other GUI SQL client (such as Sqlectron and heidisql)

Re: OPENQUERY causes "TinyTds::Error: Incorrect syntax near"

2020-07-08 Thread Jeremy Evans
On Wednesday, July 8, 2020 at 3:38:00 PM UTC-7, KING SABRI wrote: > > Hi all > > I'm trying to use OPENQUERY using sequel and I'm always getting syntax > error > > >> @db["SELECT * FROM OPENQUERY(\"SQL02.DEV\" , 'SELECT @@version')"].all > > > *The error is * > > Sequel::DatabaseError: TinyTds

OPENQUERY causes "TinyTds::Error: Incorrect syntax near"

2020-07-08 Thread KING SABRI
Hi all I'm trying to use OPENQUERY using sequel and I'm always getting syntax error > @db["SELECT * FROM OPENQUERY(\"SQL02.DEV\" , 'SELECT @@version')"].all *The error is * Sequel::DatabaseError: TinyTds::Error: Incorrect syntax near 'SQL02.DEV'. from /var/lib/gems/2.7.0/gems/sequel-5.34