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

ÔõÑùÓÃSQLÓï¾äÅжÏÒ»¸öÊý¾Ý±íÖÐÖÁÉÙNÏΪ¿Õ£¿£¿£¿

ǰÁ½ÌìÒ»¸öѧ½ãÎÊÎÒ¸öSQLÓï¾äµÄÎÊÌ⣬ÏÖÔڰѽâ¾ö·½°¸Ìù³öÀ´£¬Ò²Ëã×ܽáһϰɡ£
ËýµÄÎÊÌâÊÇ£º“Ò»¸ö±íÖÐÓÐ15¸ö×ֶΣ¬ÓÃSQLÓï¾äÅÐ¶ÏÆäÖÐ5Ïî»òÒÔÉϲ»Îª¿Õ£¬ÔõôÅжϣ¬ºÜ¼±……”¡£
µ±Ê±Î񼆾£¬Ã»¶à¿´£¬ºÇºÇ£¬²»¹»Òâ˼À²¡£µ«ÎÒÇëͬʰïËýдÁ˸ö£¬ÒÔ½âȼü֮¼±£¬ÔÚ´ËҲллСÃס£
½ñÌìÔÙ°ÑQQÁÄÌì¼Ç¼·­³öÀ´£¬Óñ¾µØÊý¾Ý¿âÊý¾Ý±íÊÔÑéÁËÏ£¬ ÓеãÎÊÌ⣬ÓÚÊÇ×Ô¼ºÐ޸ġ£
¡¾ÏêϸÇé¿ö£¬Çë²Î¿¼SQL Server Áª»ú´ÔÊé:Ë÷Òý“CASE‘£»
ms-help://MS.SQLCC.v10/MS.SQLSVR.v10.zh-CHS/s10de_6tsql/html/658039ec-8dc2-4251-bc82-30ea23708cee.htm¡¿
¡¾
select distinct (case bulletinId when bulletinId then 1 else 0 end) +
(case title when title then 1 else 0 end) +
(case body when body then 1 else 0 end) +
(case bulletinType when bulletinType then 1 else 0 end) +
(case bulletinState when bulletinState then 1 else 0 end) +
(case companyId when companyId then 1 else 0 end) +
(case userId when userId then 1 else 0 end) +
(case createtime when createtime then 1 else 0 end) as '²»Îª¿Õ×Ö¶ÎÊý' from bulletin
¡¿
µ±Êý¾Ý±íbulletinÖÐÖÁÉÙÓÐÒ»Ìõ¼Ç¼ʱ£¬Ò²¿ÉÒÔ²ÉÈ¡ÏÂÃæµÄ·½·¨¡£
¡¾
1¡¢¼òµ¥ CASE º¯Êý
select * from bulletin where
(case bulletinId when bulletinId then 1 else 0 end) +
(case title when title then 1 else 0 end) +
(case body when body then 1 else 0 end) +
(case bulletinType when bulletinType then 1 else 0 end) +
(case bulletinState when bulletinState then 1 else 0 end) +
(case companyId when companyId then 1 else 0 end) +
(case userId when userId then 1 else 0 end) +
(case createtime when createtime then 1 else 0 end) >= 5
2¡¢CASE ËÑË÷º¯Êý
select * from bulletin where
(case when bulletinId is not null or bulletinId!=''  then 1 else 0 end) +
(case when title is not null or title!='' then 1 else 0 end) +
(case when body is not null or body!='' then 1 else 0 end) +
(case when bulletinType is not null or bulletinType!='' then 1 else 0 end) +
(case when bulletinState is not null or bulletinState!='' then 1 else 0 end) +
(case when companyId is not


Ïà¹ØÎĵµ£º

PL/SQLÀý×Ó2

create or replace procedure c
(
v_deptno  in emp.deptno%type,
v_max out emp.sal%type
)
as
begin
select max(sal+nvl(comm,0)) into v_max from emp where deptno=v_deptno;
end;
create or replace procedure cc
(
v_empno  in emp.empno%type,
v_sal out emp.sal%type,
v_comm out emp.comm% ......

SQLÓï¾ä´óÈ«(2)

ÔÚ½øÐÐÊý¾Ý¿â²Ù×÷ʱ£¬Î޷ǾÍÊÇÌí¼Ó¡¢É¾³ý¡¢Ð޸ģ¬ÕâµÃÉè¼Æµ½Ò»Ð©³£ÓõÄSQLÓï¾ä£¬ÈçÏ£º
SQL³£ÓÃÃüÁîʹÓ÷½·¨£º
(1) Êý¾Ý¼Ç¼ɸѡ£º
sql="select * from Êý¾Ý±í where ×Ö¶ÎÃû=×Ö¶ÎÖµ order by ×Ö¶ÎÃû [desc]"
sql="select * from Êý¾Ý±í where ×Ö¶ÎÃû like %×Ö¶ÎÖµ% order by ×Ö¶ÎÃû [desc]"
sql="select top 10 * fro ......

ʲôÊÇSQL×¢Èë

¿ÉÄÜ´ó¼Ò»¹²»ÊǶÔSQL×¢ÈëÕâ¸ö¸ÅÄî²»ÊǺÜÇå³þ£¬¼òµ¥µØËµ,SQL×¢Èë¾ÍÊǹ¥»÷Õßͨ¹ýÕý³£µÄWEBÒ³Ãæ,°Ñ×Ô¼ºSQL´úÂë´«Èëµ½Ó¦ÓóÌÐòÖÐ,´Ó¶øÍ¨¹ýÖ´ÐзdzÌÐòÔ±Ô¤ÆÚµÄSQL´úÂë,´ïµ½ÇÔÈ¡Êý¾Ý»òÆÆ»µµÄÄ¿µÄ¡£
¡¡¡¡µ±Ó¦ÓóÌÐòʹÓÃÊäÈëÄÚÈÝÀ´¹¹Ô춯̬SQLÓï¾äÒÔ·ÃÎÊÊý¾Ý¿âʱ£¬»á·¢ÉúSQL×¢Èë¹¥»÷¡£Èç¹û´úÂëʹÓô洢¹ý³Ì£¬¶øÕâЩ´æ´¢¹ý³Ì×÷Ϊ°üº ......

SQL Server2008 Resource Governor¼ò½é


Introduction to the SQL Server 2008 Resource Governor
Database Administration, Performance Tuning | January 4, 2010 | 4:05 pm
This is an excerpt from my free eBook, Brad’s Sure Guide to SQL Server 2008.
I think most of us are familiar with this situation: a SQL Server database is the bac ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ