sql2005ÖÐÒ»¸öxml¾ÛºÏµÄÀý×Ó
sql2005ÖÐÒ»¸öxml¾ÛºÏµÄÀý×Ó ÊÕ²Ø
¸ÃÎÊÌâÀ´×ÔÂÛ̳ÌáÎÊ£¬ÑÝʾSQL´úÂëÈçÏÂ
--½¨Á¢²âÊÔ»·¾³
set nocount on
create table test(ID varchar(20),NAME varchar(20))
insert into test select '1','aaa'
insert into test select '1','bbb'
insert into test select '1','ccc'
insert into test select '2','ddd'
insert into test select '2','eee'
go
--²âÊÔ
select *from (select distinct id from test)a
OUTER APPLY(
select value=''+(
select name from test path
where id = A.id
for xml auto)+'') b
--ɾ³ý²âÊÔ»·¾³
drop table test
set nocount off
/*--½á¹û
id value
-------------------- --------------------------------------------------------------------
1
2
*/
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£ºhttp://blog.csdn.net/jinjazz/archive/2008/09/10/2910561.aspx
Ïà¹ØÎĵµ£º
VS2005+SQL2005 ASP.NET2.0Êý¾Ý¿âÁ¬½Ó×ܽá
ͨ¹ýÉÏƪÎÄÕ£¨http://www.cnblogs.com/user34j/archive/2007/01/23/628426.html£©µÄÉèÖÃÆäʵÒѾ²î²»¶àÍê³ÉÁË£¬Ö»ÊÇ»¹ÓÐһЩϸ½ÚµÄµØ·½Ã»ÓÐ×öºÃ£¬¾¹ýÒ»·¬Ñо¿ÏÖÔÚÖÕÓڸ㶨ÁË¡£¶ÔÓÚÏñÎÒÕâÑùµÄÐÂÊÖÀ´Ëµ£¬Õû¸öÊý¾Ý¿âÁ¬½ÓÕæÊDz»ÈÝÒס£ÏÖ×ܽáÈçÏ£ ......
×î¼òµ¥µÄSQL ServerÊý¾Ý¿â´æ´¢¹ý³Ì·ÖÒ³
·¢²¼Ê±¼ä£º2008.07.02 05:11 À´Ô´£ºÈüµÏÍø ×÷ÕߣºAlizze
¡¾ÈüµÏÍø£IT¼¼Êõ±¨µÀ¡¿×î¼òµ¥µÄSQL ServerÊý¾Ý¿â´æ´¢¹ý³Ì·ÖÒ³:
1.Ö»ÐèÒªÌṩSqlÓï¾äºÍÿҳµÄ¼Ç¼Êý,Ò³Êý¾Í¿ÉÒÔÁË
2,Ëٶȳ¬¿ìÓ´,100W¼Ç¼1~3Ãë¾Í·Ö³öÀ´ÁË
......
SQLÓï¾ä¸´ÖƱíµÄ·½·¨
(2009-08-29 13:41:54)
±êÇ©£º
sql
·ÖÀࣺ¼ÆËã»ú֪ʶ
Èç¹ûÄ¿µÄ±íÒѾ´æÔÚ:
insert into DATAHR.DBO.GBITEM
select * from DEMO.DBO.GBITEM
Èç¹ûÄ¿µÄ±í²»´æÔÚ:
select * into DATAHR.DBO.GBITEM
from DEMO.DBO.GBITEM
¿ç¿âµ¼Èë
select * into [zk_news].[dbo].[News1] from [zk_media].[ ......
ÎÒÃÇÔÚ¹¤×÷ÖÐÏ£ÍûÄÜ¿´¼û×Ô¼ºÔËÐеÄDMLÓï¾äµÄÔËÐб¨¸æ£¬ÀýÈçselect,delete,update,megreºÍinsertÓï¾äÔËÐкóµÄÇé¿ö£¬ÒÔÓÃÀ´¼àÊӺ͵÷ÓÅÓï¾ä¡£ÎÒÃÇͨ³£ÔÚsql*plusÖÐʹÓÃset autotrace on¿ªÆô¡£
ÄÇautotraceÊÇÈçºÎ°²×°µÄÄØ£¿thomas kyteµÄ´ó×÷Öиø³öÁËÏêϸµÄ·½·¨ºÍ½âÊÍ£º
& ......
Õ⼸Ì츺ÔðÒ»¸ö¼Ò½ÌÃÅ»§ÍøÕ¾µÄ¿ª·¢£¬»ùÓÚcakephp¿ò¼Ü¡£ÔÚÅàѵ»ú¹¹±í£¨schools£©ÖдæÔÚÒ»¸ö×Ö¶ÎsubjectÓÃÀ´´æ´¢ÁíÒ»¸öÊý¾Ý±í
£¨subjects£©ÖмǼµÄidÖµ£¬ÇÒ´æ´¢ÐÎʽΪ£º'1,2,3,4,5'¡£µ«ÊÇÔÚÓ¦Óø߼¶ËÑË÷¹ýÂËʱҳÃæselectÑ¡ÏîoptionµÄ´«ÖµÎª
subjectsµÄidÖµ£¬ÐèÒªÅжϲéѯ±íschoolsÖÐsubject×ֶδæÔÚ´Ëid£¬¼´²éѯÏÔʾ´Ë¼Ç¼ ......