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

SQL Server 2005 CTEµÄÓ÷¨

if object_id('[tb]') is not null
drop table [tb] 
go
create table [tb]([id] int,[col1] varchar(8),[col2] int) 
insert [tb] 
select 1,'ºÓ±±Ê¡',0 union all
 select 2,'ÐĮ̈ÊÐ',1 union all
 select 3,'ʯ¼ÒׯÊÐ',1 union all
 select 4,'ÕżҿÚÊÐ',1 union all
 select 5,'ÄϹ¬',2 union all 
select 6,'°ÓÉÏ',4 union all
  select 7,'ÈÎÏØ',2 union all
 select 8,'ÇåºÓ',2 union all 
select 9,'ºÓÄÏÊ¡',0 union all
 select 10,'ÐÂÏçÊÐ',9 union all
 select 11,'aaa',10 union all
 select 12,'bbb',10  
 
 ;with t as( 
select * from [tb] where col1='ºÓ±±Ê¡'  union all  select a.* from [tb] a  ,t where a.col2=t.id   
)
 
 select * from t


Ïà¹ØÎĵµ£º

·ÀÖ¹sql×¢Èë ÊÊÓÃÓÚ URL ID ´¿Êý×Ö

Àý×Ó£º  int id = Convert.ToInt32(replace((Request.QueryString["id"]), ""));
    public static string replace(string str, string str2)
    {
        str = str.Replace(";", str2);
        str = ......

SQL 2005 °²×°

ÏÂÔØsql2005ÍêÒÔºó½âѹ³öÀ´£¬´ó¼Ò¿ÉÒÔ¿´µ½cs_sql_2005_chs_x86Õâ¸öĿ¼£¬½øÈëÕâ¸öĿ¼ÔËÐÐsetup.exeÎļþ£¬°²×°³ÌÐò¾Í¿ªÊ¼ÔËÐÐÁË¡£
Ê×Ïȵ¯³öÀ´µÄÊÇÈí¼þÐí¿ÉÌõ¿î
¹´ÉÏÎÒ½Ó°®Ðí¿ÉÌõ¿îºÍÌõ¼þ£¬µãÏÂÒ»²½
ÕâÀïÁгöÁËSQL2005ÔËÐл·¾³£¬Ö±½Óµã°²×°
³ÌÐò¿ªÊ¼°²×°SQL2005ÔËÐбØÐèµÄ»·¾³£¬ÅäÖÃ×é¼þ
±ØÐèµÄ×é¼þ°²×°ºÃÁË£¬µãÏÂÒ»²½¼ ......

¼¸µÀ¾­µäµÄSQL±ÊÊÔÌâÄ¿

¼¸µÀ¾­µäµÄSQL±ÊÊÔÌâÄ¿£¨Óд𰸣©
£¨1£©±íÃû£º¹ºÎïÐÅÏ¢
¹ºÎïÈË      ÉÌÆ·Ãû³Æ     ÊýÁ¿
A            ¼×          2
B            ÒÒ     &n ......

SQL SERVER º¯Êý£¨×ª£©

SQLServer»ù±¾º¯Êý
1.×Ö·û´®º¯Êý £º
×Ö·û²Ù×÷Àà £º
upper(char_expr) תΪ´óд
lower(char_expr) תΪСд
UCase(string) ·µ»Ø Variant (String)£¬ÆäÖаüº¬×ª³É´óдµÄ×Ö·û´®¡£
LCase(string) ·µ»Ø×Ö·û´®µÄСдÐÎʽ¡£
space(int_expr) Éú³Éint_expr¸ö¿Õ¸ñ
replicate(char_expr,int_expr) ¸´ÖÆ×Ö·û´®int_expr´Î ......

35Ìõ»ù±¾SQLÓï¾ä

 1¡¢²éÕÒÔ±¹¤µÄ±àºÅ¡¢ÐÕÃû¡¢²¿ÃźͳöÉúÈÕÆÚ£¬Èç¹û³öÉúÈÕÆÚΪ¿ÕÖµ£¬ÏÔʾÈÕÆÚ²»Ïê,²¢°´²¿ÃÅÅÅÐòÊä³ö,ÈÕÆÚ¸ñʽΪyyyy-mm-dd¡£
select
emp_no,emp_name,dept,isnull(convert(char(10),birthday,120),'ÈÕÆÚ²»Ïê') birthday
from employee
order by dept
 
¡¡¡¡
2¡¢²éÕÒÓëÓ÷×ÔÇ¿ÔÚͬһ¸öµ¥Î»µÄÔ±¹¤ÐÕÃû¡¢ÐÔ±ð¡ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ