SQL »ù±¾²Ù×÷ ɾ³ý ÐÞ¸Ä Ë¢ÐÂ
SQL³£ÓÃÃüÁîʹÓ÷½·¨£º
(1) Êý¾Ý¼Ç¼ɸѡ£º
sql="select * from Êý¾Ý±í where ×Ö¶ÎÃû=×Ö¶ÎÖµ order by ×Ö¶ÎÃû [desc]"
sql="select * from Êý¾Ý±í where ×Ö¶ÎÃû like '%×Ö¶ÎÖµ%' order by ×Ö¶ÎÃû [desc]"
sql="select top 10 * from Êý¾Ý±í where ×Ö¶ÎÃû order by ×Ö¶ÎÃû [desc]"
sql="select * from Êý¾Ý±í where ×Ö¶ÎÃû in ('Öµ1','Öµ2','Öµ3')"
sql="select * from Êý¾Ý±í where ×Ö¶ÎÃû between Öµ1 and Öµ2"
(2) ¸üÐÂÊý¾Ý¼Ç¼£º
sql="update Êý¾Ý±í set ×Ö¶ÎÃû=×Ö¶ÎÖµ where Ìõ¼þ±í´ïʽ"
sql="update Êý¾Ý±í set ×Ö¶Î1=Öµ1,×Ö¶Î2=Öµ2 …… ×Ö¶În=Öµn where Ìõ¼þ±í´ïʽ"
(3) ɾ³ýÊý¾Ý¼Ç¼£º
sql="delete from Êý¾Ý±í where Ìõ¼þ±í´ïʽ"
sql="delete from Êý¾Ý±í" (½«Êý¾Ý±íËùÓмǼɾ³ý)
(4) Ìí¼ÓÊý¾Ý¼Ç¼£º
sql="insert into Êý¾Ý±í (×Ö¶Î1,×Ö¶Î2,×Ö¶Î3 …) valuess (Öµ1,Öµ2,Öµ3 …)"
sql="insert into Ä¿±êÊý¾Ý±í select * from Ô´Êý¾Ý±í" (°ÑÔ´Êý¾Ý±íµÄ¼Ç¼
Ïà¹ØÎĵµ£º
Êý¾Ý¿â²Ù×÷Àࣺ
¸´ÖÆ´úÂë ´úÂëÈçÏÂ:
/// <summary>
/// È¡µÃ×ÜÊý
/// </summary>
/// <returns></returns>
public string getTotal()
{
StringBuilder sb = new StringBuilder();
sb.Append("select count(*) total from Test");
DataTable dt = DBHelper.ExecuteDt(sb.ToString ......
½ñÌìÔÚÓÃUNION½øÐн«Á½¸ö²éѯ½áºÏʱ£¬·¢ÏÖ¼ÓÁËtextÀàÐ͵Ä×ֶνøÈ¥¾Í±¨´íÁË£¬´íÎóÐÅÏ¢ÈçÏ£º
²»ÄÜÒÔ DISTINCT ·½Ê½Ñ¡Ôñ text¡¢ntext »ò image Êý¾ÝÀàÐÍ¡£
¾¹ý·ÔÄ×ÊÁϺó²ÅÖªµÀ£¬ÔÒòÔÚÓÚÈç´Ë²Ù×÷ ÎÞ·¨¶ÔtextÀàÐÍÅжÏÊÇ·ñÖظ´£¬ËùÒÔÒªÔÚUNIONºó¼Ó¸öALL¹Ø¼ü×Ö£¬ÈçÏ£º
select top ......
--SQL½âÃÜctext×Ö¶ÎÄÚÈݺ¯Êý
--exec sp_decrypt 'Ô¼ÊøÃû³Æ'
--exec sp_decrypt 'DF_InsuranceRecord_PeriodUnit'
--exec sp_decrypt '´æ´¢¹ý³ÌÃû³Æ'
--exec sp_decrypt 'sp_SearchPrinting_InsuranceRecord'
--Ö÷ÒªÓÃ;:¶ÁÈ¡systemcommentsÖеÄ×Ö¶ÎÄÚÈÝ¡£°üÀ¨Ô¼Êø,´æ´¢¹ý³ÌµÈµÈ¡£
--ÔÎÄÓ¦¸ÃÀ´×Ôhttp://blog.csdn.net ......
¡¡²Ù×÷·ûÓÅ»¯
¡¡¡¡IN ²Ù×÷·û
¡¡¡¡ÓÃINд³öÀ´µÄSQLµÄÓŵãÊDZȽÏÈÝÒ×д¼°ÇåÎúÒ׶®£¬Õâ±È½ÏÊʺÏÏÖ´úÈí¼þ¿ª·¢µÄ·ç¸ñ¡£
¡¡¡¡µ«ÊÇÓÃINµÄSQLÐÔÄÜ×ÜÊDZȽϵ͵ģ¬´ÓORACLEÖ´ÐеIJ½ÖèÀ´·ÖÎöÓÃINµÄSQLÓë²»ÓÃINµÄSQLÓÐÒÔÏÂÇø±ð£º
¡¡¡¡ORACLEÊÔͼ½«Æäת»»³É¶à¸ö±íµÄÁ¬½Ó£¬Èç¹ûת»»²»³É¹¦ÔòÏÈÖ´ÐÐINÀïÃæµÄ×Ó²éѯ£¬ÔÙ²éѯÍâ²ãµÄ±í¼Ç¼£ ......