Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2006
    Posts
    4

    Unanswered: Job to schedule script on MySQL database

    I have a script that I need scheduled to run daily, that will create a csv flat file and have this placed on a sql 2005 server. Although I work for a large company I cannot get much support with MySQL. I've been told this is easy but maybe it's not. So tell me if this is easy or not.

    Here is the script:
    /*THIS SHOWS CURRENT ACCESS AND IS WHAT IS USED FOR CURRENT AUDIT WITH LAST TIME USED*/ run at 00:00:01 am daily
    Select DISTINCT lastname,firstname, cards.cardid, cards.usertext14,
    usertext10,cardinfo.lastTimeUsed,cardinfo.lastActi vity
    from Cards, cardaccesslevels, readers,cardinfo
    where cards.cardid = cardaccesslevels.cardid
    and cards.expiredate > getdate ()
    and cards.cardID = cardInfo.cardid
    and (CardAccessLevels.AccessLevelID = '0' /*Telco All */
    or CardAccessLevels.AccessLevelID = '1' /* Master */
    or CardAccessLevels.AccessLevelID = '2' /* Leadership Group Under Greg Satusky */
    or CardAccessLevels.AccessLevelID = '5' /* ECC */
    or CardAccessLevels.AccessLevelID = '7' /* Telco MDF BellSouth Side */
    or CardAccessLevels.AccessLevelID = '12' /* Media Storage Room */
    or CardAccessLevels.AccessLevelID ='13' /* Receiving to Chiller Room */
    or CardAccessLevels.AccessLevelID ='15' /* Service Yard to Generator Room */
    or CardAccessLevels.AccessLevelID = '17' /* Door 121 ECC to RF */
    or CardAccessLevels.AccessLevelID = '18' /* Door 122B War Room to RF */
    or CardAccessLevels.AccessLevelID = '20' /* IT Lab Core Management */
    or CardAccessLevels.AccessLevelID ='21' /* Prod RF from Vestibule */
    or CardAccessLevels.AccessLevelID = '22' /* Prod RF North */
    or CardAccessLevels.AccessLevelID = '23' /* IT Lab */
    or CardAccessLevels.AccessLevelID = '25' /* Production Raised Floor */
    or CardAccessLevels.AccessLevelID = '26' /* Battery Rooms */
    or CardAccessLevels.AccessLevelID = '27' /* UPS Rooms */
    or CardAccessLevels.AccessLevelID = '28' /* David Hart Build Out Crew */)
    order by lastname

  2. #2
    Join Date
    Aug 2002
    Location
    Germany
    Posts
    17
    Hi,

    I would suggest to use the windows task scheduler to launch the mysql commandline client. You may pipe your sql to the client and the result to your file. Using the various options you may suppress headlines and formating etc.

    Andreas

Posting Permissions

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