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

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


Ïà¹ØÎĵµ£º

Asp.Net XML²Ù×÷»ùÀà(ÐÞ¸Ä,ɾ³ý,ÐÂÔö,´´½¨)

Asp.Net XML²Ù×÷»ùÀà(ÐÞ¸Ä,ɾ³ý,ÐÂÔö,´´½¨)
2009-12-21 16:59
/**********************************************************************************
*
* ¹¦ÄÜ˵Ã÷:XML´¦Àí»ùÀà
* ×÷Õß: Áõ¹¦Ñ«;
* °æ±¾:V0.1(C#2.0);ʱ¼ä:2006-12-13
*
* ******************************************************************** ......

SQL SERVERÖеÄÊý¾Ý¿â»Ö¸´¼¼Êõ


SQL ServerÊý¾Ý¿â±¸·ÝÓÐÁ½ÖÖ·½Ê½£¬Ò»ÖÖÊÇʹÓÃBACKUP DATABASE½«Êý¾Ý¿âÎļþ±¸·Ý³öÈ¥£¬ÁíÍâÒ»ÖÖ¾ÍÊÇÖ±½Ó¿½±´Êý¾Ý¿âÎļþmdfºÍÈÕÖ¾ÎļþldfµÄ·½Ê½¡£ÏÂÃ潫Ö÷ÒªÌÖÂÛһϺóÕߵı¸·ÝÓë»Ö¸´¡£±¾Îļٶ¨ÄúÄÜÊìÁ·Ê¹ÓÃSQL Server Enterprise Manager(SQL ServerÆóÒµ¹ÜÀíÆ÷)ºÍSQL Server Quwey Analyser(SQL Server²éѯ·ÖÎöÆ÷)
¡¡¡¡
¡ ......

¼¸µÀ¾­µäµÄsqlÌâÄ¿

£¨1£©±íÃû£º¹ºÎïÐÅÏ¢
¹ºÎïÈË      ÉÌÆ·Ãû³Æ     ÊýÁ¿
A            ¼×          2
B            ÒÒ  ......

Sql Server ÈÕÆÚ¸ñʽ»¯

Sql Server ÖÐÒ»¸ö·Ç³£Ç¿´óµÄÈÕÆÚ¸ñʽ»¯º¯Êý
Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM
Select CONVERT(varchar(100), GETDATE(), 1): 05/16/06
Select CONVERT(varchar(100), GETDATE(), 2): 06.05.16
Select CONVERT(varchar(100), GETDATE(), 3): 16/05/06
Select CONVERT(varchar(100), GE ......

ÎÄ˼´´ÐµÄSQL±ÊÊÔÌâ


ÌâÄ¿£ºÓÐAºÍBÁ©¸ö±í£¬¶¼¶¨ÒåÏàͬµÄÖ÷¼ü£¬Ð´³öSQLÓï¾äÕÒ³öA±íÖÐÓжøB±íÖÐûÓеļǼ£¬È»ºó°ÑûÓеļǼ²åÈëµ½B±íÖС£
SQLÓï¾äÈçÏ£º
CREATE TABLE  A_MINUS_B  AS              ---´´½¨Ò»¸ö²î¼¯±íA_MINUS_B ,×¢ÒâSELECT Óï¾äÒ»¶¨ÒªA±íÔÚÇ°¡ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ