473,396 Members | 1,756 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

cannot get SELECT INTO FILE to work

MYsql Script
I am trying to output a concatuating file for results in a querie, if I am right the script below is actually known as a injection query and i am unable to get it to work

Expand|Select|Wrap|Line Numbers
  1.           UPDATE ${acct_table2} SET \
  2.              AcctStopTime       = '%S', \
  3.              AcctSessionTime    = '%{Acct-Session-Time}', \
  4.              AcctInputOctets    = '%{Acct-Input-Gigawords:-0}' << 32 | \
  5.                                   '%{Acct-Input-Octets:-0}', \
  6.              AcctOutputOctets   = '%{Acct-Output-Gigawords:-0}' << 32 | \
  7.                                   '%{Acct-Output-Octets:-0}', \
  8.              AcctTerminateCause = '%{Acct-Terminate-Cause}', \
  9.              AcctStopDelay      = '%{Acct-Delay-Time:-0}', \
  10.              ConnectInfo_stop   = '%{Connect-Info}' \
  11.           WHERE AcctSessionId   = '%{Acct-Session-Id}' \
  12.           AND UserName          = '%{SQL-User-Name}' \
  13.           AND NASIPAddress      = '%{NAS-IP-Address}' \
  14.  
  15.            #everything works till this point but then the following doesn't work
  16.            SELECT AcctSessionId, AcctUniqueId, UserName \
  17.                  INTO FILE '/reports/' & '%{Acct-Unique-Session-Id}' & '.CSV' \
  18.                  FIELDS TERMINATED BY ',' OPTIONALLY \
  19.                  ENCLOSED BY '"' \
  20.                  LINES TERMINATED BY '\n' \
  21.                  FROM acct_table1"
  22.  
Oct 10 '07 #1
5 1908
Atli
5,058 Expert 4TB
Hi Duncan.

Please use [code] tags when posting code.

These look like two separate queries. A UPDATE query and a SELECT query.
Have you tried running them separately?

The SELECT query also seems to be missing a FROM clause.
Oct 10 '07 #2
Hi Duncan.

Please use [code] tags when posting code.

These look like two separate queries. A UPDATE query and a SELECT query.
Have you tried running them separately?

The SELECT query also seems to be missing a FROM clause.
the problem is that i need a script to send a single record to a single csv file to a report directory everytime that a record is completed and this is done once a account stop signal is recieved, this ativates the code i have put in.
Oct 10 '07 #3
Atli
5,058 Expert 4TB
If your only goal is to add to a CSV file after you update, why don't you use whichever programming language you are using to execute the query to add this to the file?
Or is there any specific reason why you want this to be done through MySQL?
Oct 10 '07 #4
bartonc
6,596 Expert 4TB
Expand|Select|Wrap|Line Numbers
  1. #
  2. SELECT AcctSessionId, AcctUniqueId, UserName
  3.      INTO OUTFILE '/reports/'
Oct 10 '07 #5
My problem is this works on a radius server and when someone disconnects i need to send my record to my sql accounting server and therefore i have to have a csv to import but i need a new file for each completed record, the stop command is proxied to me so that is why I cannot change the program, maybe I must explain a bit further in what the program does.

It has a start record "tells me where the user is in the world and then creates a unique session id, and a start time.

Then there is multiple update queries sent to the server which up date the record for that session with data usage and time usage.

When the user logs out it then runs a stop query which ends the session at this time I want just the completed record sent to a csv file that is stored on my accounting server and is proccessed, the whole system needs to be a live system as some users may be prepaid.

If I had my way I would just do the whole accounting proccess on my linux fedora server but we are integrating into a windows server 2003 with a accounting package written spicifically for the rest of our business in SQL 2005.
Oct 12 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Michael J. Astrauskas | last post by:
I have a site where a user logs in and a session variable I created is used to keep track of the fact that the user is logged in. This various pages query a MySQL database to get information...
5
by: BashiraInTrouble | last post by:
Hi Friends, I have tried almost everything but I cant seem to shrink the transaction log. Executing DBCC SQLPERF(LOGSPACE) gives me this info: Database Log Size (MB) Log Space Used (%) ...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
3
by: Amjad | last post by:
Hi, I just wrote a test Windows Service that creates a text file on startup (please see my code below). The file is never created. Protected Overrides Sub OnStart(ByVal args() As String) Dim...
6
by: sambuela | last post by:
How can I write message to the file located in the wwwroot directory? It seems that IIS protect these files. Let make me cannot do the I/O writing sucessfully. I try to open file's write...
24
by: dancer | last post by:
Using ASP.net 1.1 and Microsoft Access. I received the following error message. Why? I have closed the Access file. I have another very small access file that opens with no trouble with the...
4
by: sirjohnofthewest | last post by:
If I possessed the power to sway the mind of every user in the world to delete all forms of Internet Explorer I would die a happy man. Hi guys, I frequently visit this site to get answers to my...
2
by: karinmorena | last post by:
I'm having 4 errors, I'm very new at this and I would appreciate your input. The error I get is: Week5MortgageGUI.java:151:cannot find symbol symbol: method allInterest(double,double,double)...
12
by: GuangXiN | last post by:
I want the file upload element disappear, instead of it, I place a text box and a button with my own css defination. but it doesn't work on IE7. What should I do now? <form action="upload.php"...
5
by: Just_a_fan | last post by:
I tried to put an "on error" statement in a routine and got the message that I cannot user "on error" and a lamda or query expression in the same routine. Help does not list anything useful for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.