2012-07-05 53 views
-1

目前我想語法從SQLPLUS改變MySQL來設定這樣可以更有條理改變從sqlplus的語法格式到MySQL格式

set pagesize 66 
set linesize 75 
ttitle center EarthOrientation Parameters(U) 2          

column year heading "Year" format 9999 
column month heading "Month" format 99 
column day heading "Day" format 99 
column mjd heading "MJD" format 99999 
select year, month , day , mjd, from  TB_PARAMETER_UI order by year,month,day,mjd; */ 

沒有人知道正確的報告文件的外觀和感覺更換setpage大小和設置行大小和tittle以及如何在mysql中設置列?

回答

0

這是在Oracle中,你可以設置MySQL中我還沒有聽說過這樣的事情,但你可以這樣做:

select LEFT(`text`,100) as columname from table1; 

其中100是卡拉科特的數量,但是如果你想結果顯示在其它格式,你可以使用\G代替;

編輯

mysql> select left(first_name,4) as short_name from t1 limit 10; 
+------------+ 
| short_name | 
+------------+ 
| PENE  | 
| NICK  | 
| ED   | 
| JENN  | 
| JOHN  | 
| BETT  | 
| GRAC  | 
| MATT  | 
| JOE  | 
| CHRI  | 
+------------+ 
10 rows in set (0.00 sec) 

編輯2:

mysql> select left(first_name,4) as short_name 
from t1 limit 10 into outfile 'test.txt'; 
Query OK, 10 rows affected (0.00 sec) 

編輯3:

試試這個:

mysql -e "select left(first_name,4) as short_name 
from t1 limit 10" -u myuser -pxxxxxxxxx mydatabase > mydumpfile.txt 

它給這樣的結果:

short_name 
PENE 
NICK 
ED 
JENN 
JOHN 
BETT 
GRAC 
MATT 
JOE 
CHRI 
+0

但我怎麼設置標題和列標題?我不明白你的上面的語法,因爲它會涉及我的? – rambokayambo 2012-07-05 18:11:53

+0

記住我輸出到文件不是MySQL客戶端? – rambokayambo 2012-07-05 18:14:56

+0

使用'as'。我編輯了一下,看看 – jcho360 2012-07-05 18:24:07