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

18¾ä»°ÈëÃÅSQLServer XML

18¾ä»°ÈëÃÅSQLServer XML ÊÕ²Ø
/*
sql xml ÈëÃÅ:
    --by jinjazz
    --http://blog.csdn.net/jinjazz
   
    1¡¢xml:        ÄÜÈÏÊ¶ÔªËØ¡¢ÊôÐÔºÍÖµ
   
    2¡¢xpath:    ѰַÓïÑÔ£¬ÀàËÆwindowsĿ¼µÄ²éÕÒ(ûÓùýdirÃüÁîµÄ»°¾ÍÈ¥Ãæ±Ú)
               
                Óï·¨¸ñʽ£¬ÕâЩÓï·¨¿ÉÒÔ×éºÏΪÌõ¼þ£º
                "."±íʾ×Ô¼º£¬".."±íʾ¸¸Ç×£¬"/"±íʾ¶ù×Ó£¬"//"±íʾºó´ú£¬
                "name"±íʾ°´Ãû×Ö²éÕÒ£¬"@name"±íʾ°´ÊôÐÔ²éÕÒ
               
                "¼¯ºÏ[Ìõ¼þ]" ±íʾ¸ù¾ÝÌõ¼þÈ¡¼¯ºÏµÄ×Ó¼¯£¬Ìõ¼þ¿ÉÒÔÊÇ
                    Êý  Öµ£ºÊý×Ö,last(),last()-Êý×Ö µÈ
                    ²¼¶ûÖµ£ºposition()<Êý×Ö,@name='Ìõ¼þ',name='Ìõ¼þ'
                Ìõ¼þÊDz¼¶ûÖµµÄʱºò¿ÉÒԺϲ¢¼ÆË㣺and or
   
    3¡¢xquery:    »ùÓÚxpath±êµÄ×¼²éѯÓïÑÔ£¬sqlserver xquery°üº¬ÈçϺ¯Êý
                exist(xpathÌõ¼þ)£º·µ»Ø²¼¶ûÖµ±íʾ½ÚµãÊÇ·ñ´æÔÚ
                query(xpathÌõ¼þ)£º·µ»ØÓÉ·ûºÏÌõ¼þµÄ½Úµã×é³ÉµÄеÄxmlÎĵµ
 &n


Ïà¹ØÎĵµ£º

18¾ä»°ÈëÃÅSQLServer XML


/*
sql xml ÈëÃÅ:
    --by jinjazz
    --http://blog.csdn.net/jinjazz
   
    1¡¢xml:        ÄÜÈÏÊ¶ÔªËØ¡¢ÊôÐÔºÍÖµ
   
    2¡¢xpath:    ѰַÓïÑÔ£¬ ......

SqlServer ÓαêÀý×Ó

 
Declare @Id int
Declare @Name varchar(20)
Declare Cur Cursor For Select Id,Name from T_User  
Open Cur
Fetch next from Cur Into @Id,@Name
While @@fetch_status=0    
Begin
    Update T_User Set [Name]=@Name,Id=@Id
    ......

Ëø³õ̽(sqlserver 2005)

HOLDLOCK ½«¹²ÏíËø±£Áôµ½ÊÂÎñÍê³É£¬¶ø²»ÊÇÔÚÏàÓ¦µÄ±í¡¢ÐлòÊý¾ÝÒ³²»ÔÙÐèҪʱ¾ÍÁ¢¼´ÊÍ·ÅËø¡£HOLDLOCK µÈͬÓÚ SERIALIZABLE¡£
NOLOCK ²»Òª·¢³ö¹²ÏíËø£¬²¢ÇÒ²»ÒªÌṩÅÅËüËø¡£µ±´ËÑ¡ÏîÉúЧʱ£¬¿ÉÄÜ»á¶ÁȡδÌá½»µÄÊÂÎñ»òÒ»×éÔÚ¶ÁÈ¡ÖÐ¼ä»Ø¹öµÄÒ³Ãæ¡£ÓпÉÄÜ·¢ÉúÔà¶Á¡£½öÓ¦ÓÃÓÚ SELECT Óï¾ä¡£
 PAGLOCK ÔÚͨ³£Ê¹Óõ¥¸ö±íËøµ ......

SQLSERVER×ÔÔöÖ÷¼ü

SQLServer Öк¬×ÔÔöÖ÷¼üµÄ±í£¬Í¨³£²»ÄÜÖ±½ÓÖ¸¶¨IDÖµ²åÈ룬¿ÉÒÔ²ÉÓÃÒÔÏ·½·¨²åÈë¡£
1. SQLServer ×ÔÔöÖ÷¼ü´´½¨Óï·¨£º
identity(seed, increment)
ÆäÖÐ
seed Æðʼֵ
increment ÔöÁ¿
ʾÀý£º
create table student(
      id int identity(1,1),
      name varcha ......

sqlserverÖÐÅжϱíÊÇ·ñ´æÔÚ

ÔÚsqlserver(Ó¦¸Ã˵ÔÚĿǰËùÓÐÊý¾Ý¿â²úÆ·)Öд´½¨Ò»¸ö×ÊÔ´Èç±í£¬ÊÓͼ£¬´æ´¢¹ý³ÌÖж¼ÒªÅжÏÓë´´½¨µÄ×ÊÔ´ÊÇ·ñÒѾ­´æÔÚ
ÔÚsqlserverÖÐÒ»°ã¿Éͨ¹ý²éѯsys.objectsϵͳ±íÀ´µÃÖª½á¹û£¬²»¹ý¿ÉÒÔÓиü·½±ãµÄ·½·¨
ÈçÏ£º
    if   object_id('tb_table') is not null 
     ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ