Data Insertion into Access DB using T-SQL

  • Hi Guys,

    I am trying to insert data from SQLServer into an access database,using T-SQL

    I used OPENROWSET to Select the data from access into SQLServer, it worked fine

    QUERY:

    SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','"ServerName"';'admin';'',TableName);

    My table has columns with the changing month names

    is there any way, i could do some sort of SELECT INTO an access DB using T-SQL ..?

    Note : This is an automated report, i cannot use Import Export Wizard, there is no SSIS installed on the machine

  • What about using ODBC and creating a linked table in Access so you have constant and immediate access to the data for the report?

  • Hi Erin, Client requirement is to have a report in push off a button.. using ODBC Linked Tables is more of a manual process.. let me know your thoughts on this.....

  • Hallo Iraju10,

    this is not possible. To push data into ACCESS with OPENROWSET.

    Basically the only possible solution is an access db and start of it by a SQL Server JOB.

    In the access db you have an autoexec macro which may pull the data into local tables.

    Another option maybe BCP but I'm not sure whether it supports mdb as OUTPUT-Format.

    Last but not least think about an SSIS package - that's exactly for solutions you are looking for.

    Microsoft Certified Master: SQL Server 2008
    MVP - Data Platform (2013 - ...)
    my blog: http://www.sqlmaster.de (german only!)

  • Another solution could be, depending on the design of the report, to put it in Excel and have a linked datasource that updates on open so that every time someone opens the report the current numbers are available. I've done book-keeping reports for clients that way.

  • we thought about implementing this report in SSIS, but we are dealing with 24 months worth of sales data, as well quarterly and yearly data, i have dynamically changing columns

    For Example : for the Month for August 2012, my table columns names will be

    tblSalesData : SalesId, Name, Address, Zip,[Aug'12],[Jul'12],[Jun'12],[May'12]...... [Sep'10],[12 Months Ended Aug'12], [Q2'12],[Q1'12],[Q4'11].....[Q4'10]

    for the Month of September 2012, my table columns names will be

    tblSalesData : SalesId, Name, Address, Zip,[Aug'12],[Jul'12],[Jun'12],[May'12]...... [Sep'10],[12 Months Ended Sep'12],[ Q3'12] [Q2'12],[Q1'12],[Q4'11].....[Q4'10] , i have built this column names using dynamic sql

    In SSIS, is there a way to map this changing column names in Data Flow Task ...?

    may i know your thoughts on this....? appreciate your help..

    Note: No Partial Quarters are allowed, so for August we start from [Q2'12], where as September we start from [Q3'12]

  • Hey Erin,

    this is an access report, where the client has the front GUI, i am populating the back end data tables

    is there way, i could populate my data into excel and feed the access tables ....?

    Thanks for your help...?

  • Sure you could do it that way. Open your excel and have it pull down the table into a worksheet and then have that worksheep mapped to a file table in access. Not sure how that's going to work with dynamic column names but it's certainly doable.

  • Do you really need the data in Access?

    If not, you could setup a linked table(s) to the source data in SQL and design the report on those tables.


    If you don't stand for something, you'll fall for anything!,

    Don Urquhart

Viewing 9 posts - 1 through 8 (of 8 total)

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