SQL Server 2000 µÄϵͳÊý¾Ý¿â
SQL Server 2000 µÄϵͳÊý¾Ý¿â
SQL Server 2000·þÎñÆ÷°²×°ºó»á½¨Á¢4ϵͳÊý¾Ý¿â¡£·Ö±ðÊÇmaster¡¢model¡¢msdb¡¢tempdb¡£
1¡¢masterÊý¾Ý¿â
masterÊý¾Ý¿âÊÇSQL Server 2000ÖÐ×îÖØÒªµÄÊý¾Ý¿â£¬¼Ç¼ÁËSQL Server 2000µÄ·þÎñÆ÷¼¶ÏµÍ³ÐÅÏ¢£¬°üÀ¨ËùÓÐÕË»§ºÍÃÜÂ룬´ÅÅ̿ռ䡢Îļþ·ÖÅäºÍʹÓá¢ÏµÍ³¼¶µÄÅäÖòÎÊý¡¢³õʼ»¯ÐÅÏ¢ºÍÆäËûÊý¾Ý¿âµÄÐÅÏ¢µÈ¡£ÓÉÓÚmasterÊý¾Ý¿â¶ÔSQL Server 2000µÄÖØÒªÐÔ£¬ËùÒÔ½¨Òé²»ÒªÖ±½ÓÐ޸ģ¬¿Éͨ¹ýϵͳ´æ´¢¹ý³ÌÀ´Ö´ÐС£
2¡¢modelÊý¾Ý¿â
modelÊý¾Ý¿â´æ´¢ÁËËùÓÐÓû§Êý¾Ý¿âºÍtempdbÊý¾Ý¿âµÄÄ£°å¡£Ëü°üº¬½«Òª¸´ÖƵ½Ã¿¸öÓû§Êý¾Ý¿âÖÐÈ¥µÄϵͳ±í¡£
3¡¢msdbÊý¾Ý¿â
msdbÊý¾Ý¿âÖ÷Òª±»SQL Server 2000´úÀí·þÎñÓÃÀ´½øÐи´ÖÆ¡¢ÈÎÎñµ÷¶È¼°ÒÔ¹ÜÀí¾¯±¨µÈ»î¶¯¡£
4¡¢tempdbÊý¾Ý¿â
tempdbÊý¾Ý¿âÊÇÒ»¸öÁÙʱÊý¾Ý¿â£¬ËüΪËùÓеÄÁÙʱ±í¡¢ÁÙʱ´æ´¢¹ý³ÌÒÔ¼°ÆäËûµÄÁÙʱ²Ù×÷Ìṩ¿Õ¼ä¡£SQL Server 2000·þÎñÆ÷µÄÖØÐÂÆô¶¯¶¼»áÖØн¨Á¢tempdbÊý¾Ý¿â¡£Ò²¾ÍÊÇ˵£¬tempdbÊý¾Ý¿âµÄÊý¾ÝÊÇÔÝʱµÄ£¬Ã¿´ÎÖØÆô¶¼»áµ¼ÖÂÒÔÇ°Êý¾ÝµÄ¶ªÊ§¡£
Ïà¹ØÎĵµ£º
1¡¢²éÕÒÔ±¹¤µÄ±àºÅ¡¢ÐÕÃû¡¢²¿ÃźͳöÉúÈÕÆÚ£¬Èç¹û³öÉúÈÕÆÚΪ¿ÕÖµ£¬ÏÔʾÈÕÆÚ²»Ïê,²¢°´²¿ÃÅÅÅÐòÊä³ö,ÈÕÆÚ¸ñʽΪyyyy-mm-dd¡£
select
emp_no,emp_name,dept,isnull(convert(char(10),birthday,120),'ÈÕÆÚ²»Ïê') birthday
from employee
order by dept
¡¡¡¡
2¡¢²éÕÒÓëÓ÷×ÔÇ¿ÔÚͬһ¸öµ¥Î»µÄÔ±¹¤ÐÕÃû¡¢ÐÔ±ð¡ ......
תÔØ£ºhttp://blog.csdn.net/cnming/archive/2009/03/11/3979290.aspx
ÔÚ²éѯ·ÖÎöÆ÷ÖÐ˳ÐòÖ´ÐÐÒÔÏÂÈý²½£¬ÆäÖÐ databasename ΪÄãµÄÊý¾Ý¿âÎļþÃû
1.Çå¿ÕÈÕÖ¾£ºDUMP TRANSACTION databasename WITH NO_LOG
2.½Ø¶ÏÊÂÎñÈÕÖ¾£ºBACKUP ......
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
&n ......
Êý¾Ý¿âÔÚͨ¹ýÁ¬½ÓÁ½ÕÅ»ò¶àÕűíÀ´·µ»Ø¼Ç¼ʱ£¬¶¼»áÉú³ÉÒ»ÕÅÖмäµÄÁÙʱ±í£¬È»ºóÔÙ½«ÕâÕÅÁÙʱ±í·µ»Ø¸øÓû§¡£
ÔÚʹÓÃleft jionʱ£¬onºÍwhereÌõ¼þµÄÇø±ðÈçÏ£º
1¡¢onÌõ¼þÊÇÔÚÉú³ÉÁÙʱ±íʱʹÓõÄÌõ¼þ£¬Ëü²»¹ÜonÖеÄÌõ¼þÊÇ·ñΪÕ棬¶¼»á·µ»Ø×ó±ß±íÖеļǼ¡£
2¡¢whereÌõ¼þÊÇÔÚÁÙʱ±íÉú³ÉºÃºó£¬ÔÙ¶ÔÁÙʱ±í½øÐйýÂ˵ÄÌõ¼þ¡£ÕâʱÒÑ ......
sqlÖ®left join¡¢right join¡¢inner joinµÄÇø±ð
×òÌìÃæÊÔ8Ò³±ÊÊÔÌâÄ¿,»ù±¾É϶¼ÊÇSQl µÄ,ÌرðÊÇÕ⼸¸öÇø±ð,¼ÇµÃ²»ÊǺÜÇåÎú,Ö»¼ÇµÃleftÊÇÒÔ×ó±íΪÖ÷±í,
rightÒÔÓÒ±íΪÖ÷±í,µ¼ÖÂ×ö´íÁ˼¸¸ö!½ñÌìËÑÁËÏÂ!×ÜËãŪÇå³þÁË!ÒÔÏÂÊÇתÌû!
left join(×óÁª½Ó) ·µ»Ø°üÀ¨×ó±íÖеÄËùÓмǼºÍÓÒ±íÖÐÁª½á×Ö¶ÎÏàµÈµÄ¼Ç¼
right j ......