If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Job to schedule script on MySQL database

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-15-07, 11:24
Row1 Row1 is offline
Registered User
 
Join Date: Jul 2006
Posts: 4
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
Reply With Quote
  #2 (permalink)  
Old 02-17-07, 06:26
sassermann sassermann is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On