Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

SQL °´ÖÜ,ÔÂ,¼¾¶È,Äê²éѯͳ¼ÆÊý¾Ý

//°´×ÔÈ»ÖÜͳ¼Æ 
select to_char(date,'iw'),sum() 
from 
where 
group by to_char(date,'iw') 
//°´×ÔÈ»ÔÂͳ¼Æ 
select to_char(date,'mm'),sum() 
from 
where 
group by to_char(date,'mm') 
//°´¼¾Í³¼Æ 
select to_char(date,'q'),sum() 
from 
where 
group by to_char(date,'q') 
//°´Äêͳ¼Æ 
select to_char(date,'yyyy'),sum() 
from 
where 
group by to_char(date,'yyyy') 


Ïà¹ØÎĵµ£º

SQL Server Out Put Excel File

SQL Server Out Put Excel File
ÔÚ SQL ServerÖÐ, µ¼³öEXCEL Îļþ, Óõ½ bcp.exe
 
 bcp  µ¼³öµÄ±¾ÖÊÊÇ´¿Îı¾Îĵµ,
ÈôÊý¾Ýº¬ÓÐÖÐÎÄ,Çëµ¼³öµ½ÖÐÎİæEXCEL,»òTXTÎĵµµÈ, ·ñÔòÂÒÂë....
ÓÃTXT ´ò¿ªÓ¢ÎİæEXCEL,Ò²¿ÉÒÔ,
 
µ¼³ö Êý¾Ýµ½C:\authors.xls, ÈôÎļþ´æÔÚÔòÖØÐ´Îļþ, ²»´æÔÚÔò´´½¨Îļþ
  ......

ά»¤Oracle³£ÓÃSQLÓï¾ä

       ÈçºÎÔ¶³ÌÅжÏOracleÊý¾Ý¿âµÄ°²×°Æ½Ì¨
¡¡¡¡select * from v$version;
¡¡¡¡²é¿´±í¿Õ¼äµÄʹÓÃÇé¿ö
¡¡¡¡select sum(bytes)/(1024*1024) as free_space,tablespace_name
¡¡¡¡from dba_free_space
¡¡¡¡group by tablespace_name;
¡¡¡¡SELECT A.TABLESPACE_NAME,A.BYTES TOTAL,B.BYTES ......

SQL Server 2005 ¾µÏñ¹¹½¨ÊÖ²á

Ò»¡¢ ¾µÏñ¼ò½é
1¡¢ ¼ò½é
Êý¾Ý¿â¾µÏñÊǽ«Êý¾Ý¿âÊÂÎñ´¦Àí´ÓÒ»¸öSQL ServerÊý¾Ý¿âÒÆ¶¯µ½²»Í¬SQL Server»·¾³ÖеÄÁíÒ»¸öSQL ServerÊý¾Ý¿âÖС£¾µÏñ²»ÄÜÖ±½Ó·ÃÎÊ;ËüÖ»ÓÃÔÚ´íÎó»Ö¸´µÄÇé¿öϲſÉÒÔ±»·ÃÎÊ¡£
Òª½øÐÐÊý¾Ý¿â¾µÏñËùÐèµÄ×îСÐèÇó°üÀ¨ÁËÁ½¸ö²»Í¬µÄSQL ServerÔËÐл·¾³¡£Ö÷·þÎñÆ÷±»³ÆÎª“Ö÷»ú”£¬µÚ¶þ¸ö·þÎñÆ÷±» ......

SQL²éѯÅÅÐòORDER BY


order by
ÅÅÐòͨ¹ýorder by×Ó¾äʵÏÖ£¬order byÔÚSELECTÓï¾äµÄ×îºó¡£  
Óï·¨£º
order by field1 [ASC|DESC][,field2 [ASC|DESC],..,fieldn [ASC|DESC]] 
ASC£ºÉýÐò
DESC£º½µÐò
ĬÈÏΪÉýÐò
¿ÕÖµ×÷ΪÎÞÇî´óÀ´´¦Àí¡£
ÁíÍâ¿ÉÒÔ°´ÕÕ²éѯÁбíÖÐÐòºÅ½øÐÐÅÅÐò¡£
ϵͳÔÚÓû§Ð´³ö²éѯÁбíµÄͬʱ¾Í¸³Óèÿ¸öÁÐÃûÒ»¸ ......

SQL ServerÊÓͼÖг£見ÏÞÖÆÌõ¼þ

--> Title  : SQL ServerÊÓͼÖг£見ÏÞÖÆÌõ¼þ
--> Author : wufeng4552
--> Date   : 2010-03-01
(1): ÊÓͼÊý¾Ý¸ü¸ÄµÄ³£見ÏÞ¶¨
µ±Óû§¸üÐÂÊÓͼÖеÄÊý¾Ýʱ,Æäʵ¸ü¸ÄµÄÊÇÆä¶ÔÓ¦µÄÊý¾Ý±íµÄÊý¾Ý.ÎÞÂÛÊǶÔÊÓͼÖеÄÊý¾Ý½øÐиü¸Ä,»¹ÊÇÔÚÊÓͼÖвåÈë»òÕßɾ³ýÊý¾Ý,¶¼ÊÇÀàËÆµÄµÀÀí.µ«ÊÇ,² ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ