SQL 2012 file processing from Access

  • Got a quick question, Is there a way to count the columns in an access table before process it and inserting that data into a SQL table?

  • cbrammer1219 - Wednesday, September 13, 2017 2:29 PM

    Got a quick question, Is there a way to count the columns in an access table before process it and inserting that data into a SQL table?

    I have some C# which enumerates the columns in an  Access table. Is that of any interest?

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • I'm thinking the ACE drivers might let you do such a thing directly.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden - Wednesday, September 13, 2017 4:44 PM

    I'm thinking the ACE drivers might let you do such a thing directly.

    I do use the ACE drivers to connect to Access DBs from C#, but 'directly' is an overly generous description of the way in which columns in a specific named table can be analysed. At least that's true of my method; no doubt there are better ways out there.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • If you're doing it from within SSIS, I'd do what Phil said... if you're reading from Access, then you can do this:
    DBEngine(0)(0).Tabledefs("TableName").Columns.Count  will work if you're reading from the current database inside Access.

Viewing 5 posts - 1 through 4 (of 4 total)

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