SQL ServerÀïÃæµÄUËø
XËø¼´ÊÇÎÒÃdz£ËµµÄÅÅËüËø£¬UËøºÜÉÙ¼û£¬Ö»ÔÚ¸üÐÂʱ»á³öÏÖ¡£UËøÆäʵÊÇXËøµÄÒ»ÖÖ£¬µ±Êý¾Ý¸üÐÂʱ£¬UËøÊ×Ïȼӵ½Òª¸üеÄÊý¾ÝÉÏ(¼´Ê¹Ä¿±êÉÏÃæÓÐSËø£¬UËø»¹ÊÇ¿ÉÒÔ¼ÓÉÏ)£¬µÈÄ¿±ê¿ÉÒÔ±»¸üÐÂʱ£¬UËø¼´×ª±äΪXËø¡£ ÈçÐèתÔØ£¬Çë×¢Ã÷±¾ÎÄÔ´´×ÔCSDN TJVictorרÀ¸£ºhttp://blog.csdn.net/tjvictor
Ïà¹ØÎĵµ£º
¾³£»áÓÐʱºòÒªÓõ½²éѯµ±Ì죬½ü¼¸Ì죬±¾ÖÜ£¬±¾ÔµÄÏà¹ØÊý¾Ý£¬ËùÒԼǼһÏÂÕâЩ±È½ÏÌØÊâµÄSQLÓï¾ä~~
--µ±Ìì
(usrRegTime >=CONVERT(varchar(10),getDate(),120)+' 00:00:00' and usrRegTime <=CONVERT(varchar (10),getDate(),120)+' 23:59:59')
--½üÈýÌì
DateDiff(day,usrRegTime,getdate()) <=3
--±¾ÖÜ
......
ÌâÄ¿£ºÓÐAºÍBÁ©¸ö±í£¬¶¼¶¨ÒåÏàͬµÄÖ÷¼ü£¬Ð´³öSQLÓï¾äÕÒ³öA±íÖÐÓжøB±íÖÐûÓеļǼ£¬È»ºó°ÑûÓеļǼ²åÈëµ½B±íÖС£
SQLÓï¾äÈçÏ£º
CREATE TABLE A_MINUS_B AS ---´´½¨Ò»¸ö²î¼¯±íA_MINUS_B ,×¢ÒâSELECT Óï¾äÒ»¶¨ÒªA±íÔÚÇ°¡ ......
µ±×°ÉÏÁËMSSQL2005ºó£¬ÄÚ´æµÄÕ¼Óûá±äµÃºÜ´ó¡£ËùÒÔÈç¹ûÓÃÒ»¸öÅúÁ¿´¦ÀíÀ´¿ªÆô»ò¹Ø±ÕMSSQL2005ËùÓеķþÎñ£¬Äǽ«»áÈÃÎÒÃǵĵçÄÔ¸üºÃʹÓ᣸ù¾Ý×Ô¼ºµÄ¾Ñ飬×ö³öÁËÏÂÃæÁ½¸öÅú´¦Àí£º
1¡¢¿ªÆô·þÎñ£º£¨¸´ÖƺáÏßµÄÄÚÈÝ£¬×¢Ò⣬·þÎñÆ÷ÕæÕýµÄÃû³ÆÄã¿ÉÒÔͨ¹ý“¿ªÊ¼--¡·¿Ø¼þÃæ°æ--¡·¹ÜÀí¹¤¾ ......
ÓÃEXPLAIN PLAN ·ÖÎöSQLÓï¾ä
http://blog.csdn.net/kj021320/archive/2006/08/19/1096021.aspx
ÈçºÎÉú³Éexplain plan?
¡¡¡¡½â´ð:ÔËÐÐutlxplan.sql. ½¨Á¢plan ±í
¡¡¡¡Õë¶ÔÌض¨SQLÓï¾ä£¬Ê¹Óà explain plan set statement_id = 'tst1' into plan_table
¡¡¡¡ÔËÐÐutlxplp.sql »ò utlxpls.sql²ì¿´explain plan
EXPLAIN PLA ......
µ¼Èë
Èç¹û±íÒÑ´æÔÚ£¬SQLÓï¾äΪ£º
insert into aa select * from OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=D:\OutData.xls;Extended Properties=Excel 8.0')...[sheet1$]
ÆäÖУ¬aaÊDZíÃû£¬D:\OutData.xlsÊÇexcelµÄȫ·¾¶ sheet1ºó±ØÐë¼ÓÉÏ$
Èç¹û±í²»´æÔÚ£¬SQLÓï¾äΪ£º
SELECT * INTO aa from OPENDAT ......