+ Reply to Thread
Results 1 to 8 of 8

best tool to import data from sql

  1. #1
    Forum Contributor
    Join Date
    09-19-2007
    Location
    Beirut
    MS-Off Ver
    0365 MSO Version 2109
    Posts
    207

    best tool to import data from sql

    hello all,

    i run my reports using MS Query to access SQL database then i save as xls file and do all sorting and deleting data and so. Is there an easier way to import requested data directly by adding certain conditions example getting records between certain dates or by family names..etc.

    thanks

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: best tool to import data from sql

    Can't you specify your requirements in your SQL code pulling the data?

  3. #3
    Forum Contributor
    Join Date
    09-19-2007
    Location
    Beirut
    MS-Off Ver
    0365 MSO Version 2109
    Posts
    207

    Re: best tool to import data from sql

    yes i can but how to put one condition with multiple names example pulling records wich contain family name "James,Davis,O'reily" only
    In Creiteria Field in can select only one name.

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: best tool to import data from sql

    Can't you write the SQL freehand?

  5. #5
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: best tool to import data from sql

    In general, you'd use the IN function:

    SELECT * FROM yourTable WHERE familyName IN ('James', 'Davis', 'O'Riely');
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  6. #6
    Forum Contributor
    Join Date
    09-19-2007
    Location
    Beirut
    MS-Off Ver
    0365 MSO Version 2109
    Posts
    207

    Re: best tool to import data from sql

    dear all,
    to make it easy here is the original dqy in notepad
    ============
    XLODBC
    1
    DSN=EDT_test1;Description=test;UID=sa;APP=Microsoft Office 2003;WSID=test-VSNET;DATABASE=CarData;Network=DBMSSOCN;Regional=Yes
    SELECT CarTravelsFormBaseQry.CarNumber, CarTravelsFormBaseQry.StartDate, CarTravelsFormBaseQry.StartDistance, CarTravelsFormBaseQry.EndDistance, CarTravelsFormBaseQry.DriverCard, CarTravelsFormBaseQry.Destination, CarTravelsFormBaseQry.DriverName, CarTravelsFormBaseQry.DriveDistance, CarTravelsFormBaseQry.StartHour, CarTravelsFormBaseQry.EndHour FROM CarData.dbo.CarTravelsFormBaseQry CarTravelsFormBaseQry WHERE (CarTravelsFormBaseQry.StartDate>=? And CarTravelsFormBaseQry.StartDate<=?) AND (CarTravelsFormBaseQry.DriverCard Like '0%') ORDER BY CarTravelsFormBaseQry.CarNumber
    Parameter Parameter
    11 11
    CarNumber StartDate StartDistance EndDistance DriverCard Destination DriverName DriveDistance StartHour EndHour
    ==================

    currently the output is all trips with id card greater than zero.
    my requirement is to limit output under destination values only equal to (townsquare,mall,HQ)
    so how to insert these under "Destination "

    thank you

  7. #7
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: best tool to import data from sql

    Add
    AND (CarTravelsFormBaseQry.Destination IN ('townsquare','mall','HQ'))
    to your WHERE clause.
    Good luck.

  8. #8
    Forum Contributor
    Join Date
    09-19-2007
    Location
    Beirut
    MS-Off Ver
    0365 MSO Version 2109
    Posts
    207

    Re: best tool to import data from sql

    thank you

    works fine

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1