473,324 Members | 2,124 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,324 software developers and data experts.

select...outfile...fixed length?

I have query that I export into a file using the "outfile" syntax. I can
use the following lines of code to create a delimited file but I want to
know if I can create a fixed length file? Any ideas?

delimited file:
Select GivenName, Surname, Address, City, State, ZipCode
into outfile 'xx.csv' fields terminated by ',' lines terminated by '\r\n'
from kbm
where zipcode = '12345'

TIA
-bruce duncan

Jul 23 '05 #1
2 3016
"Bruce D" <br*************@hotmail.com> wrote in message
news:10*************@corp.supernews.com...
I have query that I export into a file using the "outfile" syntax. I can
use the following lines of code to create a delimited file but I want to
know if I can create a fixed length file? Any ideas?

delimited file:
Select GivenName, Surname, Address, City, State, ZipCode
into outfile 'xx.csv' fields terminated by ',' lines terminated by '\r\n'
from kbm
where zipcode = '12345'

TIA
-bruce duncan


I figured out a way...but it's not perfect because I have to define the
length...is there a way so that I don't have to use rpad()?

Use rpad().
Select rpad(GivenName,15,' '), rpad(Surname,15,' '), rpad(Address,25,' ')
into outfile 'xx.csv' fields terminated by ',' lines terminated by '\r\n'
from kbm
where zipcode = '12345'

-bruce duncan
Jul 23 '05 #2
> I figured out a way...but it's not perfect because I have to define the
length...is there a way so that I don't have to use rpad()?

Use rpad().
Select rpad(GivenName,15,' '), rpad(Surname,15,' '), rpad(Address,25,' ')
into outfile 'xx.csv' fields terminated by ',' lines terminated by '\r\n'
from kbm
where zipcode = '12345'

-bruce duncan


Now I got it...if I just use "fields terminated by ''" it works just fine.
That was easy....
-bruce
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Thompson, Jordan | last post by:
I wan to use a variable for the outfile file name in a select into clause. I am doing something like: set @fileName="/tmp/result.text" SELECT col1, col2 INTO OUTFILE @fileName FIELDS...
1
by: Tom Pope | last post by:
Is there a way to have the field descriptions put into an outfile? When I do a Select * from data, the display shows the field names, however when I do the select * into outfile /tmp/test.txt the...
3
by: Michael Qiu | last post by:
I hava a select component on my form. the width of the select component is fixed,so if the length of the option's shown string larger than the select component's width,how can i make the shown string...
2
by: mark4asp | last post by:
Why does this not work in Mozilla ? <http://homepage.ntlworld.com/mark.pawelek/code/animals.html> The optHabitat_change() event does not fire. What am I doing wrong here? PS: It should...
8
by: Rich | last post by:
My table looks like this: char(150) HTTP_REF, char(250) HTTP_USER, char(150) REMOTE_ADDR, char(150) REMOTE_HOST, char(150) URL, smalldatetime TIME_STAMP There are no indexes on this table...
0
by: Wamaniyma Akolwa | last post by:
Hi I am running MYSQL 5.0 ON WINXP pro. I have the following procedure: DELIMITER $$ DROP PROCEDURE IF EXISTS LSMW_COST_SWITCH $$ CREATE PROCEDURE LSMW_COST_SWITCH() BEGIN
2
by: varusnyc | last post by:
Hello, Im having really hard time writing an Employee Payroll program that uses functions to read data from file then send all data to another file. I managed to construct some pieces of the code,...
3
by: matwilko | last post by:
hi, i am trying to create a simple version of itunes...and i am using iframes to do this. I have already set up the iframes using dreamweaver and used a drop-down menu to select the genre. When...
2
by: Nikhil | last post by:
I am using the MySQLdb python module. I have a table named 'testing' with few columns, under the 'test' database, what is hosted on a remote mysql server. I want to run the following query to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.