ºÃµÄSQLÊÕ¼¯ ²»¶Ï¸üÐÂÖÐ
1.Çó1..10żÊýÖ®ºÍ
select sum(level) from dual
where mod(level,2)=0
connect by level
2.½«update¸Ä»»³ÉÓÃrowidÀ´ÊµÏÖ¡£
£¨1£©ÐµÄд·¨£º
merge into SNAPSHOT120_2010_572 t1
using (select a.rowid rid, b.vip_level, b.manager_name
from xyf_vip_info_new b, snapshot120_2010_572 a
where b.sub_id = a.sub_id) t2
on (t1.rowid=t2.rid)
when matched then
update set t1.vip_level=t2.vip_level, t1.vip_manager=t2.manager_name
when not matched then
insert (t1.vip_level) values (null);
£¨2£©ÐÂÆæµÄд·¨
UPDATE (SELECT a.vip_level, a.vip_manager,b.vip_level AS b_vip_level, b.manager_name
from snapshot120_2010_572 a,xyf_vip_info_new b
WHERE b.sub_id = a.sub_id
)
SET vip_level = b_vip_level,vip_manager=manager_name;
3.Çó¸÷¸ö·ÖÖµºÍ×ܵÄÊýÄ¿
select decode(grouping(a.com_name),1,'Ô±¹¤×ÜÊý',a.com_name),count(b.com_id)
from a,b
where a.com_id=b.com_id
group by rollup(a.com_name);
4. »Ø¹öÊý¾Ýµ½Ìض¨Ê±¼ä
select *
from oj_group
as of timestamp to_date(sysdate,'yyyymmdd hh24:mi:ss' )
Ïà¹ØÎĵµ£º
¡¾»ã×Ü¡¿SQL CODE --- ¾µä·¾«²Ê
Êý¾Ý²Ù×÷Àà SQLHelper.cs
ÎÞÏÞ¼¶·ÖÀà ´æ´¢¹ý³Ì
°ÙÍò¼¶·ÖÒ³´æ´¢
SQL¾µä¶ÌС´úÂëÊÕ¼¯
ѧÉú±í ¿Î³Ì±í ³É¼¨±í ½Ìʦ±í
50¸ö³£ÓÃsqlÓï¾ä
SQL SERVER
ÓëACCESS¡¢EXCELµÄÊý¾Ýת»»
Óαê
¸ù¾Ý²»Í¬µÄÌõ¼þ²éѯ²»Í¬µÄ±í
INNER JOIN Óï·¨
master.dbo.sp ......
Ò»¡¢´´½¨Ò»ÕÅ¿Õ±í£º
Sql="Create TABLE [±íÃû]"
¶þ¡¢´´½¨Ò»ÕÅÓÐ×Ö¶ÎµÄ±í£º
Sql="Create TABLE [±íÃû]([×Ö¶ÎÃû1] MEMO NOT NULL, [×Ö¶ÎÃû2] MEMO, [×Ö¶ÎÃû3] COUNTER NOT NULL, [×Ö¶ÎÃû4] DATETIME, [×Ö¶ÎÃû5] TEXT(200), [×Ö¶ÎÃû6] TEXT(200))
×Ö¶ÎÀàÐÍ£º
2 : "SmallInt", // ÕûÐÍ
3 : "Int", ......
-- ²é¿´µ±Ç°dbµÄµÇ½
select * from sys.sql_logins
-- ÉóºËµÇ½Êý¾Ý¿âµÄÓû§
sql server managerment studioÖУ¬ÓÒ¼üµã¿ª·þÎñÆ÷µÄÊôÐÔ£¬ÔÚ°²È«ÐÔҳǩÖУ¬ Ñ¡ÖÐÉóºË“³É¹¦ºÍʧ°ÜµÄµÇ½”£¬ËùÓеǽ¶¼»áÔÚ..MSSQL\Log\ERRORLOGÖмǼһÌõ¼Ç¼¡£
Èç¹û¹´Ñ¡“ÆôÓÃC2ÉóºË¸ú×Ù”£¬½«»áÔÚ..MSSQL\Log\Ŀ¼ ......
SQL SERVER 2008 Òì²½²¶»ñ±íÊý¾ÝÐÞ¸Ä
дµÄ²»¶ÔµÄµØ·½Çë¸÷λָÕý£¬Ð´µÄÒ²±È½ÏÂÒ¡£½²¾¿Õâ¿´°É¡£^ ^
/*
SQL SERVER 2008 Òì²½²¶»ñ±íÊý¾ÝÐÞ¸Ä
SQL server 2008ΪÒì²½¸ú×ÙËùÓз¢ÉúÔÚÓû§±íÉϵÄÊý¾ÝÐÞ¸ÄÌṩÁËÄÚ½¨µÄ·½·¨,
¶ø²»ÐèÒª±àд×Ô¶¨ÒåµÄ´¥·¢Æ÷»òÕß²éѯ,±ä¸üÊý¾Ý²¶»ñÓµÓÐ×îСÐÔÄÜ¿ªÏú,¿ÉÒÔ
Ó ......
1.ɾ³ý±í
select 'drop table ' || table_name || ' purge;'
from user_tables
where length(table_name) <= 4;
ɾ³ý´øÔ¼ÊøµÄ±í
Drop table ±íÃû cascade constraints;
2.²éѯview&ͬÒå´Ê
--˵Ã÷£º¿ÉÒÔ¸ù¾ÝÊÓͼµÄtext_length ......