ODBC Field list

Posted on 2004-11-10
Last Modified: 2008-03-17
This is probably a very simple question. I have a linked server to my MS SQL 7.0 that is an AS400 system. How do I run a query through the sql to return fields only off the 400?  I run quires all the time through it to return rows and etc, but I lack the syntax to just get a field list. This is an ODBC connection via open query.

Question by:Jojo1771
    LVL 50

    Accepted Solution

    select * from YourTable where 0=1

    or via open query

    you could try

    ( select * from yourtable fetch first 1 row only)  Db2/udb syntax
    LVL 5

    Author Comment

    Worked perfectly. Both answers that is.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    Title # Comments Views Activity
    Moving SQl Server SBS 2003 to SQL Server 2014 27 99
    Select distinct 25 43
    C# primary key 9 46
    ms sql + top 1 for each customer 3 22
    The steps for moving the system databases to a new location are documented in the following technical article: However sometimes after the moving process is finished, though SQL i…
    The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
    Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
    Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now