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

sql °Ñ±íµ¼³É.TXTÎļþ

sql ´úÂë:
---------------------------------------------------------
/*
  a        ±íÃû
  Èç¹ûÔÚsql ²éѯ·ÖÎöÆ÷µ±ÖгöÏÖ
  " SQL Server ×èÖ¹Á˶Ô×é¼þ 'xp_cmdshell' µÄ ¹ý³Ì'sys.xp_cmdshell' µÄ·ÃÎÊ£¬ÒòΪ´Ë×é¼þÒÑ×÷Ϊ´Ë·þÎñÆ÷°²È«ÅäÖõÄÒ»²¿·Ö¶ø±»¹Ø±Õ¡£ÏµÍ³¹ÜÀíÔ±¿ÉÒÔͨ¹ýʹÓà sp_co"Õâ¸ö´íÎ󡣡£ÇëÖ´ÐдúÂ룺
sp_configure 'show advanced options',1
reconfigure
go
sp_configure 'xp_cmdshell',1
reconfigure
*/
declare @sqlstr varchar(3000)
set @sqlstr='bcp "select * from a" queryout "c:\123.txt" -c -T'
exec master.dbo.xp_cmdshell  @sqlstr
תÔØ/*http://www.zhujiangroad.com/html/soft/s7773.html*/
·½·¨£­£ºÓÃBCPÃüÁî
bcp ʵÓù¤¾ß
bcp ʵÓù¤¾ßÔÚ Microsoft® SQL Server™ 2000 ʵÀýºÍÊý¾ÝÎļþÖ®¼äÒÔÓû§Ö¸¶¨µÄ¸ñʽ¸´Êý¾Ý¡£
Óï·¨
 
bcp {[[database_name.][owner].]{table_name | view_name} | "query"}
{in | out | queryout | format} data_file
[-m max_errors] [-f format_file] [-e err_file]
[-F first_row] [-L last_row] [-b batch_size]
[-n] [-c] [-w] [-N] [-V (60 | 65 | 70)] [-6]
[-q] [-C code_page] [-t field_term] [-r row_term]
[-i input_file] [-o output_file] [-a packet_size]
[-S server_name[\instance_name]] [-U login_id] [-P password]
[-T] [-v] [-R] [-k] [-E] [-h "hint [,...n]"]
²ÎÊýdatabase_name
Ö¸¶¨µÄ±í»òÊÓͼËùÔÚÊý¾Ý¿âµÄÃû³Æ¡£Èç¹ûδָ¶¨£¬ÔòΪÓû§Ä¬ÈÏÊý¾Ý¿â¡£
owner
±í»òÊÓͼËùÓÐÕßµÄÃû³Æ¡£Èç¹ûÖ´ÐдóÈÝÁ¿¸´ÖƲÙ×÷µÄÓû§ÓµÓÐÖ¸¶¨µÄ±í»òÊÓͼ£¬Ôò owner ÊÇ¿ÉÑ¡µÄ¡£Èç¹ûûÓÐÖ¸¶¨ owner ²¢ÇÒÖ´ÐдóÈÝÁ¿¸´ÖƲÙ×÷µÄÓû§²»ÓµÓÐÖ¸¶¨µÄ±í»òÊÓͼ£¬Ôò Microsoft® SQL Server™ 2000 ½«·µ»Ø´íÎóÐÅÏ¢²¢È¡Ïû´óÈÝÁ¿¸´ÖƲÙ×÷¡£
table_name
Êǽ«Êý¾Ý¸´ÖƵ½ SQL Server ʱ (in) µÄÄ¿µÄ±íÃû£¬ÒÔ¼°´Ó SQL Server ¸´ÖÆÊý¾Ýʱ (out) µÄÔ´±íÃû¡£
view_name
Êǽ«Êý¾Ý¸´ÖƵ½ SQL Server ʱ (in) µÄÄ¿µÄÊÓͼÃû£¬ÒÔ¼°´Ó SQL Server ¸´ÖÆÊý¾Ýʱ (out) µÄÔ´ÊÓͼÃû¡£Ö»ÓÐÆäÖÐËùÓÐÁж¼ÒýÓÃͬһ¸ö±íµÄÊÓͼ²ÅÄÜÓÃ×÷Ä¿µÄÊÓͼ¡£Óйؽ«Êý¾Ý¸´ÖƵ½ÊÓͼµÄÏÞÖƵĸü¶àÐÅÏ¢£¬Çë²Î¼û INSERT¡£
Query
ÊÇ·µ»ØÒ»¸ö½á¹û¼¯µÄ Transact-SQL ²éÑ


Ïà¹ØÎĵµ£º

SQLÊý¾Ý¿â Ô¤·À·Ç·¨±íD99_Tmp,kill_kkµÄ½¨Á¢

·ÀÖ¹·Ç·¨±íD99_Tmp,kill_kkµÄ³öÏÖÊÇ·ÀÖ¹ÎÒÃǵÄÍøÕ¾²»±»¹¥»÷,ͬʱҲÊÇSQL°²È«·À·¶Ò»µÀ±ØÒªµÄ·ÀÏß,Ëä˵ÀûÓÃÕâÖÖ·½Ê½¹¥»÷µÄÈ˶¼ÊǺڿÍÖеÄСÄñ,µ«ÊÇÎÒÃÇÒ²²»µÃ²»·À,ÒÔÃâÔì³É²»¿ÉÏëÏóµÄºó¹û,·Ï»°²»¶à˵ÁË,˵Ï·À·¶·½·¨:
xp_cmdshell¿ÉÒÔÈÃϵͳ¹ÜÀíÔ±ÒÔ²Ù×÷ϵͳÃüÁîÐнâÊÍÆ÷µÄ·½Ê½Ö´Ðиø¶¨µÄÃüÁî×Ö·û´®,²¢ÒÔÎı¾Ðз½Ê½·µ»ØÈκÎÊ ......

DBMS_SQL°üʵÏÖ¶¯Ì¬SQL

.ÔÚ²éѯÖлáÓöµ½ UNION ALL,ËüµÄÓ÷¨ºÍunionÒ»Ñù,Ö»²»¹ýunionº¬ÓÐdistinctµÄ¹¦ÄÜ,Ëü»á°ÑÁ½ÕűíÁËÖظ´µÄ¼Ç¼ȥµô,¶øunion all²»»á,ËùÒÔ´ÓЧÂÊÉÏ,union all »á¸ßÒ»µã.
2.union all ÊÇ°´Ô­ÏÈ˳ÐòÅÅÁеģ¬union °ÑÁ½ÕűíÖеÄÖظ´Êý¾ÝÈ¥µôºó»¹½øÐÐÁËÖØÐÂÅÅÐò
ÉùÃ÷£º´ËÎÄÀ´Ô´ÓÚÍø·£¡
ÄÚÈÝÕªÒª£ºÔÚPL/SQL¿ª·¢¹ý³ÌÖУ¬Ê¹ÓÃSQL£¬ ......

sql server 2000 ³£¼û´íÎó£¬ÏµÍ³126´íÎó£¡

תÔØ£º
http://blog.sina.com.cn/s/blog_5f4ed9cb0100dza0.html
http://wowh.wuyan.org/2008/04/15/sqlserver-2k-system-error-126/
ÔÚ°²×°sql server ¾­³£Óöµ½ÕâÑù¡¢ÄÇÑùµÄ´íÎ󣬽ñÌìÔÚËѵ½±È½ÏÈ«ÃæµÄ£¬¾ÍÌù³öÀ´£¬·ÖÏíÏ£¡
SQL
Server°²×°ÎÊÌâ´óÈ«
(2007-09-06
09:24:28)
±êÇ©£ºIT/¿Æ¼¼
 
Ò¼¡£WINDOWS XP ......

һЩ²»´íµÄsqlÓï¾ä

1¡¢ËµÃ÷£º¸´ÖƱí(Ö»¸´Öƽṹ,Ô´±íÃû£ºa бíÃû£ºb) (Access¿ÉÓÃ)
·¨Ò»£ºselect * into b from a where 1<>1
·¨¶þ£ºselect top 0 * into b from a
2¡¢ËµÃ÷£º¿½±´±í(¿½±´Êý¾Ý,Ô´±íÃû£ºa Ä¿±ê±íÃû£ºb) (Access¿ÉÓÃ)
insert into b(a, b, c) select d,e,f from b;
3¡¢ËµÃ÷£º¿çÊý¾Ý¿âÖ®¼ä±íµÄ¿½±´(¾ßÌåÊý¾ÝʹÓþø¶Ô· ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ