Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Openquery

Author  Topic 

peace
Constraint Violating Yak Guru

420 Posts

Posted - 2012-04-04 : 22:51:22
I exceute an openquery select top 100* or where condition but get the error:

An error occurred while preparing the query "
select top 100 * from tableA
" for execution against OLE DB provider "MSDASQL" for linked server "testing"


SELECT *
into #A
FROM openquery
( [testing],

'
select top 100 * from tableA
'
)

If without the select top 100* or without the where condition, i manage to pull out the data.
How can I solve this?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-04 : 23:22:45
which is type of server you're connecting to?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

peace
Constraint Violating Yak Guru

420 Posts

Posted - 2012-04-04 : 23:24:34
ODBC FIREBIRD
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-04 : 23:26:07
if its firebird top 100 wont work

it should be FIRST 100

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

peace
Constraint Violating Yak Guru

420 Posts

Posted - 2012-04-04 : 23:34:49
It wont work for WHERE condition as well?

Im trying to apply:

where createdate > DATEADD(d, -1, CONVERT(date, GETUTCDATE()))
Go to Top of Page

peace
Constraint Violating Yak Guru

420 Posts

Posted - 2012-04-05 : 00:37:10
Ok i get it.
It should be like this.

cast(''Today'' as date)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-05 : 01:18:52
ideally syntax used inside openquer should be firebird based

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -