Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259

    Unanswered: Select * But ____

    How would i select * from a table, except n fields?
    for e.g. SELECT * FROM File_Table except FieldName1, FieldName2....

    i have a lotta fields..and i only want to remove 2 fields;
    i dont want to do SELECT FIeld1, Field2.....Field(n)
    ...

    thx

  2. #2
    Join Date
    Jan 2004
    Posts
    492

    Re: Select * But ____

    Originally posted by Jerrie
    How would i select * from a table, except n fields?
    for e.g. SELECT * FROM File_Table except FieldName1, FieldName2....

    i have a lotta fields..and i only want to remove 2 fields;
    i dont want to do SELECT FIeld1, Field2.....Field(n)
    ...

    thx

    Cant do that unfortunately - either:

    Select *

    or

    explicitly name the columns

    Select col1, col2, col3...etc.

    Sorry!

  3. #3
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259
    awww shucks; is there a way to iterate through field(n) where n is an integer?

    oh yea, i have an idea! since i'm doin this query programitcally anyways...i could just exclude for values of i;
    for i = 1 to rec.recordcount
    if i <> (specific value) then
    .....do stuff
    next


    thx!

  4. #4
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259
    i meant No.fields in the table (another functiON)..not recordcount

  5. #5
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346
    If you are using ADO the number of fields in your recordset is a property of the Recordset object. Here is an example:

    dim cn as ADODB.connection
    dim rs as ADODB.recordset

    set cn = new ADODB.connection

    cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Test.mdb;Persist Security Info=False"

    cn.open

    set rs = new ADODB.recordset

    rs.actiiveconnection = cn

    rs.open "SELECT * FROM Table1"

    MsgBox "The number of fields in Table1 are: " & rs.Fields.Count

    rs.close

    cn.close

    set rs=nothing
    set cn = nothing
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

Posting Permissions

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