sql serverÊÓͼµÄ×÷Óã¨×ª£©
ËùνÊÓͼ£¨View£©ÆäʵÊÇÖ´ÐвéѯÓï¾äºóµÃµ½µÄ½á¹û£¬µ«Õâ¸ö²éѯ½á¹û¿ÉÒÔ·ÂÕæ³ÉÊý¾Ý±íÀ´Ê¹Óã¬ËùÒÔÓÐÈËÒ²³ÆËüΪ“ÐéÄâÊý¾Ý±í”£¬ÊÓͼÔÚ²Ù×÷ÉϺÍÊý¾Ý±íûÓÐʲôÇø±ð£¬µ«Á½ÕߵIJîÒìÊÇÆä±¾ÖÊÊDz»Í¬µÄ£ºÊý¾Ý±íÊÇʵ¼Ê´æ´¢¼Ç¼µÄµØ·½£¬È»¶øÊÓͼ²¢²»±£´æÈκμǼ£¬Ëü´æ´¢µÄʵ¼ÊÉÏÊDzéѯÓï¾ä£¬ÆäËù³ÊÏÖ³öÀ´µÄ¼Ç¼ʵ¼ÊÀ´×ÔÓÚÊý¾Ý±í£¬¿ÉÒÔΪ¶àÕÅÊý¾Ý±í£¬´ó¼ÒÓÉ´Ë¿ÉÒÔÔ¤¼ûµ½ÊÓͼӦÓõĵ¯ÐÔ£¡ÎÒÃÇ¿ÉÒÔÒÀ¾Ý¸÷ÖÖ²éѯÐèÒª´´½¨²»Í¬ÊÓͼ£¬µ«²»»áÒò´Ë¶øÔö¼ÓÊý¾Ý¿âµÄÊý¾ÝÁ¿¡£
ÏÂÃæ×ܽáÊÓͼµÄ¼¸´óÓŵ㣺1.ÔöÇ¿¿É¶ÁÐÔ 2.Êý¾Ý°²È«¼°±£ÃÜ£ºÕë¶Ô²»Í¬Óû§£¬¿ÉÒÔ´´½¨²»Í¬ÊÓͼ£¬ÏÞÖÆÆäËùÄÜä¯ÀÀºÍ±à¼µÄÊý¾ÝÄÚÈÝ¡£3.½µµÍ²éѯ¸´ÔÓ¶È 4.·½±ãά»¤¡£
×ÜÖ®£¬ÉÆÓÚÔËÓÃÊÓͼ¿ÉÒÔÈÃÊý¾Ý¿âµÄÉè¼Æ¡¢¹ÜÀí¼°Ê¹Óö¼¸ü¼ÓÓÐЧÂÊ¡¢¸ü¼Ó·½±ã¡£
ÊÓͼ¿ÉÒÔ±»¿´³ÉÊÇÐéÄâ±í»ò´æ´¢²éѯ¡£¿Éͨ¹ýÊÓͼ·ÃÎʵÄÊý¾Ý²»×÷Ϊ¶ÀÌصĶÔÏó´æ´¢ÔÚÊý¾Ý¿âÄÚ¡£Êý¾Ý¿âÄÚ´æ´¢µÄÊÇ SELECT Óï¾ä¡£SELECT Óï¾äµÄ½á¹û¼¯¹¹³ÉÊÓͼËù·µ»ØµÄÐéÄâ±í¡£Óû§¿ÉÒÔÓÃÒýÓñíʱËùʹÓõķ½·¨£¬ÔÚ Transact-SQL Óï¾äÖÐͨ¹ýÒýÓÃÊÓͼÃû³ÆÀ´Ê¹ÓÃÐéÄâ±í¡£Ê¹ÓÃÊÓͼ¿ÉÒÔʵÏÖÏÂÁÐÈÎÒ»»òËùÓй¦ÄÜ£º
½«Óû§ÏÞ¶¨ÔÚ±íÖеÄÌض¨ÐÐÉÏ¡£
ÀýÈ磬ֻÔÊÐí¹ÍÔ±¿´¼û¹¤×÷¸ú×Ù±íÄڼǼÆ乤×÷µÄÐС£
½«Óû§ÏÞ¶¨ÔÚÌض¨ÁÐÉÏ¡£
ÀýÈ磬¶ÔÓÚÄÇЩ²»¸ºÔð´¦Àí¹¤×ʵ¥µÄ¹ÍÔ±£¬Ö»ÔÊÐíËûÃÇ¿´¼û¹ÍÔ±±íÖеÄÐÕÃûÁС¢°ì¹«ÊÒÁС¢¹¤×÷µç»°ÁкͲ¿ÃÅÁУ¬¶ø²»ÄÜ¿´¼ûÈκΰüº¬¹¤×ÊÐÅÏ¢»ò¸öÈËÐÅÏ¢µÄÁС£
½«¶à¸ö±íÖеÄÁÐÁª½ÓÆðÀ´£¬Ê¹ËüÃÇ¿´ÆðÀ´ÏóÒ»¸ö±í¡£
¾ÛºÏÐÅÏ¢¶ø·ÇÌṩÏêϸÐÅÏ¢¡£
ÀýÈ磬ÏÔʾһ¸öÁеĺͣ¬»òÁеÄ×î´óÖµºÍ×îСֵ¡£
ͨ¹ý¶¨Òå SELECT Óï¾äÒÔ¼ìË÷½«ÔÚÊÓͼÖÐÏÔʾµÄÊý¾ÝÀ´´´½¨ÊÓͼ¡£SELECT Óï¾äÒýÓõÄÊý¾Ý±í³ÆΪÊÓͼµÄ»ù±í¡£ÔÚÏÂÀýÖУ¬pubs Êý¾Ý¿âÖÐµÄ titleview ÊÇÒ»¸öÊÓͼ£¬¸ÃÊÓͼѡÔñÈý¸ö»ù±íÖеÄÊý¾ÝÀ´ÏÔʾ°üº¬³£ÓÃÊý¾ÝµÄÐéÄâ±í£º
CREATE VIEW titleview
AS
SELECT title, au_ord, au_lname, price, ytd_sales, pub_id
from authors AS a
JOIN titleauthor AS ta ON (a.au_id = ta.au_id)
JOIN titles AS t ON (t.title_id = ta.title_id)
Ö®ºó£¬¿ÉÒÔÓÃÒýÓñíʱËùʹÓõķ½·¨ÔÚÓï¾äÖÐÒýÓà titleview¡£
SELECT *
from titleview
Ò»¸öÊÓͼ¿ÉÒÔÒýÓÃÁíÒ»¸öÊÓͼ¡£ÀýÈ磬titleview ÏÔʾµÄÐÅÏ¢¶Ô¹ÜÀíÈËÔ±ºÜÓÐÓ㬵«¹«Ë¾Í¨³£Ö»ÔÚ¼¾¶È»òÄê¶È²ÆÎñ±¨±íÖвŹ«²¼±¾
Ïà¹ØÎĵµ£º
ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......
select d.code,d.name, sum(w.weight) weight,round(avg(w.price),2) price,sum(w.money) money
from weight_info w left outer join t_dict d on w.productcode=d.code left outer join t_balancecode b on w.balancecode=b.balancecode where 1=1 and w.operdate>TO_TIMESTAMP('2009-11-2 04:12:32.0', ' ......
Ò»¡¢ÉîÈëdz³öÀí½âË÷Òý½á¹¹
¡¡¡¡Êµ¼ÊÉÏ£¬Äú¿ÉÒÔ°ÑË÷ÒýÀí½âΪһÖÖÌØÊâµÄĿ¼¡£Î¢ÈíµÄsql serverÌṩÁËÁ½ÖÖË÷Òý£º¾Û¼¯Ë÷Òý£¨clustered index£¬Ò²³Æ¾ÛÀàË÷Òý¡¢´Ø¼¯Ë÷Òý£©ºÍ·Ç¾Û¼¯Ë÷Òý£¨nonclustered index£¬Ò²³Æ·Ç¾ÛÀàË÷Òý¡¢·Ç´Ø¼¯Ë÷Òý£©¡£ÏÂÃ棬ÎÒÃǾÙÀýÀ´ËµÃ÷һϾۼ¯Ë÷ÒýºÍ·Ç¾Û¼¯Ë÷ÒýµÄÇø±ð£º
¡¡¡¡Æäʵ£¬ÎÒÃǵĺºÓï× ......
Ç°ÑÔÀÎÒ̸µ½ÁËһЩFORTRAN³ÌÐòÔ±ºÍÒ»ÃûLISP³ÌÐòÔ±µÄÊ£¬Ç°ÕßÖ»»áʹÓÃÑ»·À´½â¾öÎÊÌ⣬ºóÕßÖ»»áʹÓõݹ鷽ʽ½â¾öÎÊÌâ¡£ÕâÖÖÇé¿ö²¢²»
ÉÙ¼û£¬ÒòΪÈËÃǶ¼Ï²»¶Ê¹ÓÃ×Ô¼ºÁ˽âµÄ¹¤¾ß¡£ÏÂÃæ½²Ò»¸öЦ»°£¬²»ÊÇÕæÊ£ºÓÐÈ˸øÒ»¸öÊýѧ¼Ò¡¢Ò»¸öÎïÀíѧ¼ÒºÍÒ»¸öÊý¾Ý¿â³ÌÐòÔ±¸÷·¢ÁËÒ»¸öÏðƤÇò£¬²¢ÇÒÈÃËûÃÇÈ·
¶¨ÇòµÄÌå»ý¡£
Êýѧ¼Ò ......
д³É´æ´¢¹ý³Ì£¬½¨Á¢×÷Òµ¶¨Ê±±¸·Ý~~~
--ÔÚsqlÖÐÓ³ÉäһϾͿÉÒÔÁË
exec master..xp_cmdshell 'net use z: \\yizhi\D$ "ÃÜÂë" /user:yizhi\administrator'
/*--˵Ã÷:
exec master..xp_cmdshell 'net use z: \\xz\c$ "ÃÜÂë" /user:xz\administrator'
z:ÊÇÓ³ÉäÍøÂç·¾¶¶ÔÓ¦±¾»úµÄÅÌ·û,ÓëÏÂÃæµÄ±¸·Ý¶ÔÓ¦
\\xz\c$ÊÇÒªÓ³ÉäµÄÍ ......