SQL Server 2000½Ì²Ä¶ÁÊé±Ê¼Ç£¨2£©
½ñÌì¿´Á˵ÄÄÚÈÝÊÇÏÂÃæµÄ: 1.5 ·þÎñÆ÷¶ËÓë¿Í»§¶ËÍøÂç¿âµÄÉèÖà ʲôÊÇÍøÂç¿â,ÎÒµÄÀí½â¾ÍÊÇÍøÂçÁ¬½ÓµÄÐÒé¼°¸÷ÖÖÉèÖÃ. 1.5.1 ·þÎñÆ÷ÍøÂç¿âµÄÉèÖà 1.5.2 ÅäÖÿͻ§¶ËµÄÍøÂç¿â µÚ1´Î½øÐÐÁ˽âÁË¡£ 1.6 SQL Server ·þÎñÆ÷µÄ×¢²áÓëÁ¬½Ó Ã÷°×ÁËΪʲôҪע²áÓëÁ¬½Ó£¬Ö÷ÒªÊÇÓ¦ÓÃÓÚÔ¶³Ì·þÎñÆ÷µÄ¡£ 1.6.1 ×¢²á·þÎñÆ÷Ç°Ó¦Á˽âµÄ֪ʶ 1.·þÎñÆ÷µÄµÇ¼ÕÊ»§ÓëÑéÖ¤ 2.ϵͳĬÈϵǼÕÊ»§ 1.6.2 ×¢²á·þÎñÆ÷ ÊìϤÁ˲½Öè 1.6.3 Ð޸ķþÎñÆ÷µÄ×¢²áÊôÐÔÓëɾ³ý·þÎñÆ÷ 1.6.4 ÉèÖÃSQL Server µÇ¼Éí·ÝÑé֤ģʽ 1.7 ÆóÒµ¹ÜÀíÆ÷¡¢²éѯ·ÖÎöÆ÷ºÍÁª»ú´ÔÊé ´óÌåÁ˽âÉÏÃæ3¸ö³ÌÐòµÄ×÷Óᣠ»¹ÓÐÏ°ÌâºÍʵѵû×ö£¬Òª»¨Ê±¼ä×öÁË¡£
Ïà¹ØÎĵµ£º
1.×Ö·û´®º¯Êý
³¤¶ÈÓë·ÖÎöÓÃ
datalength(Char_expr) ·µ»Ø×Ö·û´®°üº¬×Ö·ûÊý,µ«²»°üº¬ºóÃæµÄ¿Õ¸ñ
substring(expression,start,length) ²»¶à˵ÁË,È¡×Ó´®
right(char_expr,int_expr) ·µ»Ø×Ö·û´®ÓÒ±ßint_expr¸ö×Ö·û
×Ö·û²Ù×÷Àà
upper(char_expr) תΪ´óд
lower(char_expr) תΪСд
space(int_expr) Éú³Éint_expr¸ö¿Õ¸ñ ......
½øÈësql*plusÐèÒªÊäÈëÓû§Ãû¡¢¿ÚÁîºÍÖ÷»ú±êÖ¾·û
system/manager
sys/change_on_intall
scott/tiger
internal/oracle
ÒÔÉÏΪ³õʼÃÜÂë
Ö÷»ú×Ö·û´®¿Õ»òÕßÊÇ@+ÄãµÄ·þÎñÃû,ÔÚ±¾µØµÇ½²»ÐèÒª±¾µØ·þÎñÃû¡£
ÏÂÃæ¾Í½éÉÜÒ»ÏÂһЩ³£ÓõÄsql*plusÃüÁ
Ê×ÏȲ鿴µ±Ç°Ê¹ÓõÄÊý¾Ý¿âʵÀý:
select name from V$database;
Çл»Á½¸ö ......
ÓйطÖÒ³ SQL µÄ×ÊÁϺܶ࣬ÓеÄʹÓô洢¹ý³Ì£¬ÓеÄʹÓÃÓαꡣ±¾È˲»Ï²»¶Ê¹ÓÃÓα꣬ÎÒ¾õµÃËüºÄ×Ê¡¢Ð§Âʵͣ»Ê¹Óô洢¹ý³ÌÊǸö²»´íµÄÑ¡Ôñ£¬ÒòΪ´æ´¢¹ý³ÌÊǾ¹ýÔ¤±àÒëµÄ£¬Ö´ÐÐЧÂʸߣ¬Ò²¸üÁé»î¡£ÏÈ¿´¿´µ¥Ìõ SQL Óï¾äµÄ·ÖÒ³ SQL °É¡£
·½·¨1£º
ÊÊÓÃÓÚ SQL Server 2000/2005
SELECT TOP Ò³´óС *
from tab ......
Óï·¨£º
isnull(check_expression,replacement_expression)
²ÎÊýcheck_expressionÓëreplacement_expressionÀàÐÍÐèÏàͬ
·µ»ØÖµ£º
Èôcheck_expressionΪnull£¬Ôò·µ»Øreplacement_expression
Èôcheck_expression²»Îªnull£¬Ôò·µ»Øcheck_expression ......
num_field number(12,2);
±íʾnum_fieldÊÇÒ»¸öÕûÊý²¿·Ö×î¶à10λ¡¢Ð¡Êý²¿·Ö×î¶à2λµÄ±äÁ¿¡£
case.....when Ó÷¨£¨Óëdecode£¨£©×÷ÓúÜÏñ£©
select case zsxm_dm
when '02' then
'Ó ......