Results 1 to 11 of 11

Thread: ms sql queries against informix database[resolved]

  1. #1

    Thread Starter
    Hyperactive Member thebloke's Avatar
    Join Date
    May 2003
    Posts
    358

    Resolved ms sql queries against informix database[resolved]

    Guys

    I'm having a problem running some queries in sqlserver against an informix database. The database is set up as a linked server through enterprise manager and I can run some basic queries using a system DSN named electra:

    Code:
    select * from openquery
    (electra,'select * from agent')
    fine, however if I try anything more than that, eg:

    Code:
    select * from openquery
    (electra, 'select top 10 * from agent')
    I get nasty errors:

    Code:
    Server: Msg 7399, Level 16, State 1, Line 1
    OLE DB provider 'MSDASQL' reported an error.  
    [OLE/DB provider returned message: ODBC Driver cannot be used because it does not support one or more of the following APIs: SQLTables, SQLColumns, or SQLGetTypeInfo.]
    OLE DB error trace [OLE/DB Provider 'MSDASQL' IDBInitialize::Initialize returned 0x80004005:   ].
    This isn't necessarily the query I want to run, there will be a few, it's just that anything I try other than a basic select returns this error.

    Any ideas?!

    Cheers
    Last edited by thebloke; Jun 9th, 2005 at 10:30 AM. Reason: resolved
    The Bloke
    www.blokeinthekitchen.com
    making cooking cool for blokes

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: ms sql queries against informix database

    Does the Informix database support TOP? I know it never used to, and this is probably why it isn't working.

    I would recommend writing the query directly against Informix first, then once it is working copy it into your call to OpenQuery.

    Note that you can do the TOP part outside the OpenQuery if you need to, it just won't be as efficient (as all the data in the table will have to move between the servers, rather than just 10 records).

  3. #3

    Thread Starter
    Hyperactive Member thebloke's Avatar
    Join Date
    May 2003
    Posts
    358

    Re: ms sql queries against informix database

    Quote Originally Posted by si_the_geek
    Does the Informix database support TOP? I know it never used to, and this is probably why it isn't working.

    I would recommend writing the query directly against Informix first, then once it is working copy it into your call to OpenQuery.

    Note that you can do the TOP part outside the OpenQuery if you need to, it just won't be as efficient (as all the data in the table will have to move between the servers, rather than just 10 records).
    Eh?!

    Sorry, I don't know owt about Informix databases. I was hoping, probably naively, that I could just use standard sql queries. I guess not! What is TOP?
    Last edited by thebloke; Jun 3rd, 2005 at 04:43 PM.
    The Bloke
    www.blokeinthekitchen.com
    making cooking cool for blokes

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: ms sql queries against informix database

    Unfortunately there isn't really "standard" SQL beyond the most basic Select/Insert/Delete etc. There are two defined sets of standards (SQL-89 and SQL-92), but each DBMS tends to have its own interpretation of these, as well as its own extra functions.

    I'm afraid you need to check the syntax and functions for each new database system you use, as very few are exactly compatible (but the majority are pretty close). The biggest issue tends to be joins - even MS Access and MS SQL Server aren't quite the same on this!

    To the best of my knowledge Informix doesnt support the Top clause for select statements, but I could be wrong (over 2 years since I last used it!).

  5. #5

    Thread Starter
    Hyperactive Member thebloke's Avatar
    Join Date
    May 2003
    Posts
    358

    Re: ms sql queries against informix database

    Quote Originally Posted by thebloke
    Eh?!

    Sorry, I don't know owt about Informix databases. I was hoping, probably naively, that I could just use standard sql queries. I guess not! What is TOP?
    Sorry, what a dunce! I've re-read what I've written! Doh!

    Does anyone know of a good resource for Informix syntax/functions?

    The Bloke
    www.blokeinthekitchen.com
    making cooking cool for blokes

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: ms sql queries against informix database[resolved]

    The company has been bought out a couple of times over the years, so I'm not sure whether or not this will be accurate for the version you are using. IBM have reference material for Informix here:

    http://publib.boulder.ibm.com/infoce...help/index.jsp

    The equivalent of the manual I used to get my SQL info from is under the following section of the navigation:
    Developing - Developing SQL Statements - Guide to SQL: Syntax - SQL Statements

  7. #7

    Thread Starter
    Hyperactive Member thebloke's Avatar
    Join Date
    May 2003
    Posts
    358

    Re: ms sql queries against informix database[resolved]

    Thanx
    The Bloke
    www.blokeinthekitchen.com
    making cooking cool for blokes

  8. #8
    New Member
    Join Date
    Jun 2005
    Location
    Uruguay
    Posts
    2

    Re: ms sql queries against informix database[resolved]

    la sintáxis correcta en informix es:

    'select first 10 * from agent'

    esto a mi me anduvo.


  9. #9

    Thread Starter
    Hyperactive Member thebloke's Avatar
    Join Date
    May 2003
    Posts
    358

    Re: ms sql queries against informix database[resolved]

    Quote Originally Posted by Luciano Lezama
    la sintáxis correcta en informix es:

    'select first 10 * from agent'

    esto a mi me anduvo.

    Gracias!
    The Bloke
    www.blokeinthekitchen.com
    making cooking cool for blokes

  10. #10
    New Member
    Join Date
    Jun 2005
    Location
    Uruguay
    Posts
    2

    Smile Re: ms sql queries against informix database[resolved]

    Quote Originally Posted by thebloke
    Gracias!
    de nada

  11. #11

    Thread Starter
    Hyperactive Member thebloke's Avatar
    Join Date
    May 2003
    Posts
    358

    Re: ms sql queries against informix database[resolved]

    The Bloke
    www.blokeinthekitchen.com
    making cooking cool for blokes

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width