A solution to SQL reformatting problem
Posted in 1992
Hi, A few weeks ago someone brought up the problem where sql changes the output format from one record per line to each column on a line by itself when the output would be wider than 80 characters. I've found a solution for UNIX systems. It appears that sql looks at the width of the output device as defined by the "columns" variable in the stty data structure when it makes a decision to change format or not. To fool sql into not changing the format, reset the value of columns variable in your current session to be wide enough that sql thinks there's enough room. I have a table whose _record_width_ is 455 chars. It's default display width is quite a bit bigger. First I check the current settings. apache% stty -a which gives me this output... speed 38400 baud, 24 rows, 80 columns ... I then reset the columns width to 1000 characters. apache% stty columns 1000 If I run the stty command again, I can see that the columns have changed. apache% stty -a speed 38400 baud, 24 rows, 1000 columns ... From here I run my sql script and it writes one record per line. Remember to reset your tty device back when your done. ------------------------------------------------------------------------------ Jeff Cauhape / cauhape@twg.com / The Wollongong Group, Inc. #include <std_disclaimer.h> ------------------------------------------------------------------------------