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

SQLÓï¾äµ¼Èëµ¼³ö´óÈ«


£¨×¢Òâoffice2007µÄͬѧ°Ñprivider='Microsoft.Jet.OLEDB.4.0'¸ÄΪ'Microsoft.ACE.OLEDB.12.0'¡£¡£offiec2003Óë2007µÄÌṩÆ÷ÊDz»Ò»ÑùµÄ¡£¡££©
 
 
 
 
SQLÓï¾äµ¼Èëµ¼³ö´óÈ«[ÊÕ¼¯]
/******* µ¼³öµ½excel
EXEC master..xp_cmdshell 'bcp SettleDB.dbo.shanghu out c:\temp1.xls -c -q -
S"GNETDATA/GNETDATA" -U"sa" -P""'
/*********** µ¼ÈëExcel
SELECT *
from OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\test.xls";User ID=Admin;Password=;Extended properties=Excel
5.0')...xactions
/*¶¯Ì¬ÎļþÃû
declare @fn varchar(20),@s varchar(1000)
set @fn = 'c:\test.xls'
set @s ='''Microsoft.Jet.OLEDB.4.0'',
''Data Source="'+@fn+'";User ID=Admin;Password=;Extended properties=Excel 5.0'''
set @s = 'SELECT * from OpenDataSource ('+@s+')...sheet1$'
exec(@s)
*/
SELECT cast(cast(¿ÆÄ¿±àºÅ as numeric(10,2)) as nvarchar(255))+'¡¡' ת»»ºóµÄ±ðÃû
from OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\test.xls";User ID=Admin;Password=;Extended properties=Excel
5.0')...xactions
/********************** EXCELµ¼µ½Ô¶³ÌSQL
insert OPENDATASOURCE(
         'SQLOLEDB',
         'Data Source=Ô¶³Ìip;User ID=sa;Password=ÃÜÂë'
         ).¿âÃû.dbo.±íÃû (ÁÐÃû1,ÁÐÃû2)
SELECT ÁÐÃû1,ÁÐÃû2
from OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\test.xls";User ID=Admin;Password=;Extended properties=Excel
5.0')...xactions
/** µ¼ÈëÎı¾Îļþ
EXEC master..xp_cmdshell 'bcp dbname..tablename in c:\DT.txt -c -Sservername -Usa -
Ppassword'
/** µ¼³öÎı¾Îļþ
EXEC master..xp_cmdshell 'bcp dbname..tablename out c:\DT.txt -c -Sservername -Usa -
Ppassword'
»ò
EXEC master..xp_cmdshell 'bcp "Select * from dbname..tablename" queryout c:\DT.txt -c -
Sservername -Usa -Ppassword'
µ¼³öµ½TXTÎı¾£¬ÓöººÅ·Ö¿ª
exec master..xp_cmdshell 'bcp "¿âÃû..±íÃû" out "d:\tt.txt" -c -t ,-U sa -P password'
BULK INSERT ¿âÃû..±íÃû
from 'c:\test.txt'
WITH (


Ïà¹ØÎĵµ£º

SQL ServerµÄÁ´½Ó·þÎñÆ÷¼¼ÊõС½á

Ò»¡¢Ê¹Óà Microsoft OLE DB Provider For ODBC Á´½ÓMySQL
°²×°MySQLµÄODBCÇý¶¯MyODBC
1¡¢ÎªMySQL½¨Á¢Ò»¸öODBCϵͳÊý¾ÝÔ´£¬ÀýÈ磺ѡÔñÊý¾Ý¿âΪtest ,Êý¾ÝÔ´Ãû³ÆΪ
myDSN
2¡¢½¨Á¢Á´½ÓÊý¾Ý¿â
EXEC sp_addlinkedserver  @server = 'MySQLTest', @srvproduct='MySQL',
@provider = 'MSDASQL', @datasrc = 'myDSN'
......

sqlÅúÁ¿Ìæ»»Ìض¨×Ö·û

×î½üÔÚºÍÒ»¸ö¹«Ë¾ºÏ×÷ÏîÄ¿£¬Óв¿·ÖÁ´½ÓÊÇÓÉËûÃǹ«Ë¾ÌṩµÄ£¬ÓÉÓÚµ±Ê±»¹Ã»ÓÐÉêÇëÓòÃû£¬Ö±½ÓÌṩ¸øÎÒÃǵÄÊÇipµØÖ·£¬ÏÖÔÚÕýʽÉÏÏߺó£¬ÐèÒªÎÒÃǽ«Ô­À´µÄipµØÖ·Ì滻ΪÓòÃû£¬Èç¹ûÒ»¸ö¸öÌæ»»ÆðÀ´ÌرðÂé·³£¬¶øÇÒ¿ÉÄܳöÏÖÎÊÌ⣬Òò´ËÕÒÁËÏÂoracleÖÐsqlÅúÁ¿Ìæ»»µÄ¹¦ÄÜ£¬Ê¹ÓÃÆðÀ´Ì«·½±ãÁË£¬ÔÚÕâÀï¼Ç¼Ï£¬±ãÓÚÒÔºó²éÕÒ¡£¾ßÌåʹÓÃ˵Ã÷ÈçÏ ......

PL SQLÖи´ÖƳöµÄÖÐÎÄÂÒÂë

֮ǰʹÓÃPLSQL£¬¶¼ÊÇÒÔдÈëÄÚÈÝΪÖ÷£¬Ð´ÈëÖÐÎÄÄÚÈÝżÓÐÂÒÂ룬µ«ÊÇÖ»ÔÚÏÔʾÉϲ¢Î´Ó°Ïì´æÈ¡£¬ËùÒÔûÓÐÔÚÒâ¡£
½ñÌìÔÚÐÞ¸ÄÒ»¸öÊÓͼʱ£¬ÐèÒª½«ÐÞ¸ÄÄÚÈݼǼÏÂÀ´£¬so,Ïëд¸öÐ޸ļǼ£¬¾Í°ÑÊÓͼÄÚÈÝ¿½±´Á˳öÏÖ£¬·¢ÏÖ¿½±´³öÏÖµÄÖÐÎÄÄÚÈݳöÏÖÂÒÂë¡£
²¢Î´ÍêÈ«ÔÚÒ⣬ÒÔΪֻҪԭÑù·Å»Øplsql¾Í»áºÃµÄ£¬µ«ÊDZ£´æÔÙÈ¡³ö·Åµ½plsqlÖз¢ÏÖÈÔ ......

ÄãÖªµÀ¶àÉÙ¹ØÓÚsql select top N?

±³¾°:
sql select top N Óï¾äÊÇÒ»¸ö·Ç³£ÖØÒªµÄÓï¾ä, ÔÚʵÏÖ·ÖÒ³²éѯÖÐÊDz»¿É»òȱµÄ. ÓÉÓÚ·ÖÒ³²éѯͨ³£Éæ¼°º¬ÓдóÁ¿¼Ç¼µÄ±í£¬ ²¢ÇÒÊÇΪ´óÁ¿Óû§·ÖÏíµÄÈÎÎñ£¬Òò´Ë£¬¶ÔÆä½øÐÐÓÅ»¯ÊǺÜÓÐÒâÒåµÄ¡£
ʵÏÖsql top N µÄ¹¦ÄÜÓм¸ÖÖ±äÖÖ£º
1. set rowcount @n; select ... order by somefields
2. select top (@n) .... order by ......

SQL Server ÃæÊÔÌâ £¨³ÖÐø¸üÐÂÖÐ...£©

3¡£±íÄÚÈÝÈçÏÂ
¡¡¡¡-----------------------------
¡¡¡¡ID LogTime
¡¡¡¡1 2008/10/10 10:00:00
¡¡¡¡1 2008/10/10 10:03:00
¡¡¡¡1 2008/10/10 10:09:00
¡¡¡¡2 2008/10/10 10:10:00
¡¡¡¡2 2008/10/10 10:11:00
¡¡¡¡......
¡¡¡¡-----------------------------
¡¡¡¡ÇëÎʸ÷λ¸ßÊÖ£¬ÈçºÎ²éѯµÇ½ʱ¼ä¼ä¸ô²»³¬ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ