MS-Query to return results to excel (SQL syntax help needed)

  • In MsQuery I'm using the following SQL successfully (via a ".dqy" file - MS Excel Query File) to extract my database records into Excel. What i'd like to do is change the syntax of my SQL statement so i only have to specify my table names on the FROM statement and not mention the database name (on the FROM statement)

    SQL that works:

    XLODBC

    1

    DSN=PCT UP CQ.dsn;Description=PCT UP CQ;UID=myuid;PWD=mypassword;APP=Microsoft Office XP;WSID=MYSERVERNAME;DATABASE=PCTUPUSER

    SELECT EnhancementRequest.id, EnhancementRequest.description, EnhancementRequest.headline, FROM pctupuser.pctupuser.EnhancementRequest EnhancementRequest WHERE (EnhancementRequest.headline Like '%PCM%')

    --> I would like to have the FROM statement appear as...

    FROM EnhancementRequest etc... (no mention of pctupuser.pctupuser)

    My database name is PCTUPUSER and i can use the "USE PCTUPUSER" command to switch to it but i then still need to say...

    "FROM pctupuser.EnhancementRequest EnhancementRequest WHERE ...etc....

    any ideas on what i can do to eliminate the second "PCTUPUSER" name in my SQL? (i'm not sure why i need to mention it twice???  is that the "owner"??)

    Thanks folks!! 

    kw

  • Remove the two pctupuser's in the SQL statement and OK it. They'll come back - so that's a no

    Your Database name is "pctupuser" and the table/s owner name is "pctupuser" hence the structure database.owner.tablename, even when you log in as the owner.

    Maybe someone has had a different experience.

    DB


    The systems fine with no users loggged in. Can we keep it that way ?br>

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply