SQL¡¢PL/SQLѧϰ±Ê¼Ç
1£®SQL²¢Ðвéѯ
alter session enable parallel dml execute immediate 'alter session enable parallel dml'; --Ð޸ĻỰ²¢ÐÐDML select /*+parallel(a,4)*/ * from table_name a select /*+parallel(a,8)*/ * from table_name a select /*+parallel(a,4) parallel(b,4) parallel(c,4)*/ a.*,b.*,c.* from table_name<st1:chmetcnv w:st="on" unitname="a" sourcevalue="1" hasspace="True" negative="False" numbertype="1" tcsc="0"><st1:address w:st="on" unitname="a" sourcevalue="1" hasspace="True" negative="False" numbertype="1" tcsc="0">1 a</st1:address></st1:chmetcnv>,table_name2 b,table_name c insert /*+parallel(t,4)*/ into table_name t insert /*+parallel(t,8)*/ into table_name t /*+parallel(t,8)*/ ²¢Ðд¦Àí£¬Ò»°ãΪCPUµÄ±¶ÊýÈ磺4£¬8µÈ,ÔÚÖ´ÐÐÀàÐÍSQL±ØÐëÏÈÔËÐÐ:alter session enable parallel dml
2£®É¾³ý±í·ÖÇøÊý¾Ý
alter table masamk.tb_mk_sc_user_mon truncate partition mk_user_mon_'||trim(iv_month) ɾ³ýÖ¸¶¨±í·ÖÇøÊý¾Ý
3£®minus(²î¼¯)Óëintersect(½»¼¯)
minus Ö¸ÁîÊÇÔËÓÃÔÚÁ½¸ö SQL Óï¾äÉÏ¡£ËüÏÈÕÒ³öµÚÒ»¸ö SQL Óï¾äËù²úÉúµÄ½á¹û£¬È»ºó¿´ÕâЩ½á¹ûÓÐûÓÐÔÚµÚ¶þ¸ö SQL Óï¾äµÄ½á¹ûÖÐ,Èç¹ûÓеĻ°£¬ÄÇÕâÒ»±Ê×ÊÁϾͱ»È¥³ý£¬¶ø²»»áÔÚ×îºóµÄ½á¹ûÖгöÏÖ; Èç¹ûµÚ¶þ¸ö SQL Óï¾äËù²úÉúµÄ½á¹û²¢Ã»ÓдæÔÚÓÚµÚÒ»¸ö SQL Óï¾äËù²úÉúµÄ½á¹ûÄÚ£¬ÄÇÕâ±Ê×ÊÁϾͱ»Å×Æú¡£ intersect Ö¸ÁîÊÇÔËÓÃÔÚÁ½¸öSQLÓï¾äÉÏ£¬Èç¹ûÁ½¸öSQLÓï¾äµÄ¼Ç¼ÍêÈ«ÏàͬÔòÏÔʾÏàÓ¦¼Ç¼£¬·ñÔò½«²»ÔÚ½á¹ûÖгöÏÖ
4£®Order by ÖÐµÄ nulls last
order by area_code,bill_month nulls last --nulls last ½«ÅÅÐò×Ö¶ÎΪnull¼Ç¼·ÅÔÚ×îºóÃæ
5£®nvlµÄ¼¸¸ö²»Í
Ïà¹ØÎĵµ£º
×òÌìÎÒµÄSQL£¨Microsoft SQL Server 2005 £©µÇ¼²»ÉÏÈ¥ÁË£¬ÔÀ´ÊdzöÏÖÁ˼¸¸öСÎÊÌ⣬ÏÖÔڼǼһÏÂÎҵĽâ¾öÕ⼸¸öÇé¿öµÄ°ì·¨¡££¨½â¾ö·½·¨ÓкܶàÖÖ£¬ÕâЩֻÊÇÎҵĽâ¾ö·½·¨£¬½ö¹©²Î¿¼£©
²éÕÒÎÊÌâµÄ¹ý³Ì£º£¨×¢£ºÓÃwindowsÕ˺Ż¹ÊÇ¿ÉÒԵǼµÄ£©
µÚÒ»²½£ºÆô¶¯ËùÓÐÓëSQLÓйصķþÎñ£¬ÎÊÌâÒÀ¾É£»
µÚ¶þ²½£º²é¿´windows·À»ðǽ£¬±»Ä¬ ......
linq to sql ÔÚ²åÈëÖµµÄʱºò»¹ÊǺܷ½±ã¡£ÓÐʱºòÎÒÃÇÐèÒªÔÚ²åÈëÒ»¸öеÄʵÌåÖ®ºóµÃµ½ÄǸöʵÌåµÄÖ÷¼üIDµÄÖµ£¬Õâ¸öIDµ±È»±ØÐëÊÇ×ÔÔö¡£Ò»¶Îʱ¼äÎÒÒ»Ö±ÈÏΪֱ½ÓʹÓÃlinq to sqlµÄ²åÈë»úÖÆÊDz»¿ÉÒÔÔÚ×öµ½µÄ£¬ËùÒÔÖ»ÓÐʹÓô洢¹ý³ÌµÄ£¬¾ßÌå¿ÉÒԲ鿴ÕâƪÎÄÕ£ºhttp://blog.benhall.me.uk/2008/01/custom-insert-logic-with-linq-to- ......
SQLµÄ»ù±¾¶ÔÏóÖ÷ÒªÓг£Á¿£¬±íʾ·û£¬·Ö¸ô·û£¬±£Áô¹Ø¼ü×Ö¡£
1¡¢³£Á¿
³£Á¿ÊÇÒ»¸ö°üº¬ÎÄ×ÖÓëÊý×Ö£¬Ê®Áù½øÖÆ»òÊý×Ö³£Á¿¡£Ò»¸ö×Ö·û´®³£Á¿°üº¬µ¥ÒýºÅ('')»òË«ÒýºÅ("")×Ö·û¼¯ÖеÄÒ»¸ö»ò¶à¸ö×Ö·û¡£
Èç¹ûÏëÔÚµ¥ÒýºÅ·Ö¸ôµÄ×Ö·û´®ÖÐÓõ½µ¥¶ÀµÄÒýºÅ£¬¿ÉÒÔÔÚÕâ¸ö×Ö·ûÖÐÓû§Á¬ÐøµÄµ¥ÒýºÅ£¨¼´ÓÃÁ ......
²âÊÔ»útest°²×°µÄÊÇwindows server2008+sql server 2008£¬Êý¾Ý¿â°²×°³É¹¦¡£¿ÉÒÔÁ¬½Ó¾ÖÓòÍøÄÚÆäËû»úÆ÷µÄÊý¾Ý¿â£¨ÆäËû»úÆ÷µÄÊý¾Ý¿âΪSQL 2005£©¡£µ«ÊÇÍøÄÚÆäËû»úÆ÷·ÃÎÊtestʱ£¬ÎÞ·¨Á¬½Ó£¬±¨´í¡£ÐÅϢΪ£ºÔÚ½¨Á¢Óë·þÎñÆ÷µÄÁ¬½Óʱ³ö´í¡£ÔÚÁ¬½Óµ½SQL SERVER 2005ʱ£¬ÔÚĬÈϵÄÉèÖÃÏÂSQL SERVER ²»ÔÊÐí½øÐÐÔ¶³ÌÁ¬½Ó¿ÉÄܻᵼÖ´Îʧ°Ü ......
SQLÓï¾äÏÈǰдµÄʱºò£¬ºÜÈÝÒ×°ÑһЩÌØÊâµÄÓ÷¨Íü¼Ç£¬ÎÒÌØ´ËÕûÀíÁËÒ»ÏÂSQLÓï¾ä²Ù×÷¡£
Ò»¡¢»ù´¡
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CREATE DATABASE database-name
2¡¢ËµÃ÷£ºÉ¾³ýÊý¾Ý¿â
drop database dbname
3¡¢ËµÃ÷£º±¸·Ýsql server
--- ´´½¨ ±¸·ÝÊý¾ÝµÄ device
USE master
EXEC sp_addumpdevice 'disk', 'testBack', 'c:\mssq ......