sql´æ´¢¹ý³Ì
ÔÚASP.NetÏîÄ¿ÖÐʹÓô洢¹ý³Ì,Ê×ÏÈ¿ÉÒÔÌá¸ßÊý¾Ý¿âµÄ°²È«ÐÔ£¬Æä´Î¿ÉÒÔÌá¸ßÔËÐÐSQL´úÂëÔËÐеÄËٶȣ¬ÔÚ´óÐÍÏîÄ¿ÖÐÒ»°ãÊDZز»¿ÉÉٵġ£Visual Studio.NetΪSQLµÄ´æ´¢¹ý³ÌÌṩÁËÇ¿´óµÄÖ§³Ö£¬Äú¼È¿ÉÒÔͨ¹ývisual studio.netÀ´Ð½¨´æ´¢¹ý³Ì£¬Ò²¿ÉÒÔÖ±½ÓÔÚSql ServerµÄ²éѯ·ÖÎöÆ÷ÖÐÔËÐУ¬»¹¿ÉÒÔͨ¹ýÆóÒµ¹ÜÀíÆ÷´´½¨£¬Ê¹ÓÃÆðÀ´Ò²·Ç³£·½±ã¡£´ó¼ÒÒ»Ö±¶¼ÎóÈÏΪSQL´æ´¢¹ý³ÌÊÇÒ»¸ö±È½Ï“¸ßÉļ¼Êõ£¬ÆäʵÕÆÎÕÒ»°ãµÄÓï·¨ÊÇûÓÐʲô´óÎÊÌâµÄ£¬¶øÎÒÃÇÔÚʹÓô洢½Ì³ÌÖÐÒ²Ö÷ÒªÊÇÔöɾ¼õµÄ²Ù×÷£¬Ñ§»áʹÓÃÒ»°ãµÄT-SQL¾ÍºÜÈÝÒ×ÉÏÊÖÁË¡£
ÎÒÃÇÏÈÀ´¿´Ò»ÏÂÔÚSql-serverÖÐÊÇÈçºÎ´´½¨Ò»¸ö´æ´¢¹ý³ÌµÄ°É£¬ÎÒÃÇ¿ÉÒÔʹÓÃSQLÃüÁîÓï¾ä´´½¨£¬Ò²¿ÉÒÔͨ¹ýSQL serverÖеÄÆóÒµ¹ÜÀíÆ÷À´´´½¨£¬µ«Æäʵ¶¼ÊÇÀë²»¿ª×Ô¼ºÐ´Óï¾äµÄ£¬µ±È»ÏµÍ³´æ´¢¹ý³ÌÎÒÃǾͲ»ÓÃÈ¥¶¯ËüÁË£¨´æ´¢¹ý³Ì·ÖΪϵͳ´æ´¢¹ý³Ì £¬±¾µØ´æ´¢¹ý³Ì£¬ÁÙʱ´æ´¢¹ý³Ì£¬Ô¶³Ì´æ´¢¹ý³Ì£¬À©Õ¹´æ´¢¹ý³Ì£©£¬¶ø±¾µØ´æ儲過³Ì¾ÍÊÇÎÒ們×Ô¼º編寫µÄ´æ´¢¹ý³Ì£¬ÆäʵҲ½ÐÓû§´æ´¢¹ý³Ì¡£
µ±´´½¨´æ´¢¹ý³ÌʱÐèҪȷ¶¨´æ´¢¹ý³ÌµÄÈý¸ö×é³É²¿·Ö
ËùÓеÄÊäÈë²ÎÊýÒÔ¼°´«¸øµ÷ÓÃÕßµÄÊä³ö²ÎÊý
±»Ö´ÐеÄÕë¶ÔÊý¾Ý¿âµÄ²Ù×÷Óï¾ä°üÀ¨µ÷ÓÃÆäËü´æ´¢¹ý³ÌµÄÓï¾ä
·µ»Ø¸øµ÷ÓÃÕßµÄ״ֵ̬ÒÔÖ¸Ã÷µ÷ÓÃÊdzɹ¦»¹ÊÇʧ°Ü
Ò»¡¢´æ´¢¹ý³Ì´´½¨
1.ÓÃÆóÒµ¹ÜÀíÆ÷À´´´½¨´æ´¢¹ý³Ì;
ÎÒÃÇÏÈ´ò¿ªÆóÒµ¹ÜÀíÆ÷£¬ÕÒµ½ÎÒÃÇÒª´´½¨´æ´¢¹ý³ÌµÄÊý¾Ý¿â£¬Èçͼһ:
ÎÒÃÇ¿ÉÒÔ¿´µ½£¬ÔÚÊý¾Ý¿âÀïÃæÓÐÒ»¸ö´æ´¢¹ý³ÌµÄÏîÄ¿£¬ÎÒÃÇÒªÓõ½µÄ¾ÍÊÇËüÁË£¬Ñ¡Öд洢¹ý³ÌÕâÏÎÒÃÇ¿ÉÒÔ¿´µ½Êý¾Ý¿âÖÐÀïÃæ±¾Éí¾ÍÓкܶà´æ´¢¹ý³Ì´æÔÚµÄÁË£¬²»¹ýÕâЩ¶¼ÊÇÊý¾Ý¿â±¾Éí×Ô´øµÄ£¬ÎÒÃÇ¿ÉÒÔ¿´µ½ËûµÄÀàÐÍÊÇϵͳ£¨Èçͼ¶þ£©£¬Èç¹ûÎÒÃÇ×Ô¼º´´½¨µÄ´æ´¢¹ý³Ì£¬ÀàÐ;ÍÊÇÓû§ÁË.
ÔÚ¿ØÖÆÊ÷µÄ×ó±ß£¬ÎÒÃÇÑ¡Öд洢¹ý³Ìºóµ¥»÷Êó±êÓÒ¼ü£¬¿ÉÒÔ¿´µ½ÓÐÒ»¸ö“´´½¨´æ´¢¹ý³ÌµÄÑ¡Ïî”
Ñ¡ÖÐÕâÏ¾Í»á³öÏÖеĴ°¿ÚÁË£¬Õâ¸ö´°¿Ú¾ÍÊÇÓÃÀ´Ð´´æ´¢¹ý³ÌµÄÁË
ÔÚʵ¼ÊÔËÓùý³ÌÖУ¬ÎÒÃÇËù´´½¨µÄ´æ´¢¹ý³Ì²¢²»ÊÇÏëÏñÖеÄÕâô¸´ÔÓ£¬¶øÉÏÃæµÄÕâЩ²ÎÊýÒ²²»ÊǶ¼ÒªÓÃÉÏ£¬µ«Ò»°ãÎÒÃÇÔÚÓòéѯ·ÖÎöÆ÷´´½¨´æ´¢¹ý³ÌÇ°£¬¶¼»áͨ¹ýÏÂÃæÕâÌõÓï¾äÀ´²éѯһÏ£¬ÔÚÊý¾Ý¿âÖÐÊÇ·ñÒѾ´æÔÚÏàͬÃüÃûµÄ´æ´¢¹ý³Ì,Èç¹û´æÔڵĻ°£¬ÔòÏÈɾ³ý¡£
If exists(select name from sysobjects where name=’´æ´¢¹ý³ÌÃû’ and type=’p’)
Drop procedure ‘´æ´¢¹ý³ÌÃû’
Go
ÔÚÕâÀÎÒÃÇÒ²¾Í
Ïà¹ØÎĵµ£º
ͨ³££¬ÄãÐèÒª»ñµÃµ±Ç°ÈÕÆںͼÆËãһЩÆäËûµÄÈÕÆÚ£¬ÀýÈ磬ÄãµÄ³ÌÐò¿ÉÄÜÐèÒªÅжÏÒ»¸öÔµĵÚÒ»Ìì»òÕß×îºóÒ»Ìì¡£ÄãÃǴ󲿷ÖÈË´ó¸Å¶¼ÖªµÀÔõÑù°ÑÈÕÆÚ½øÐзָÄê¡¢Ô¡¢Èյȣ©£¬È»ºó½ö½öÓ÷ָî³öÀ´µÄÄê¡¢Ô¡¢ÈյȷÅÔÚ¼¸¸öº¯ÊýÖмÆËã³ö×Ô¼ºËùÐèÒªµÄÈÕÆÚ£¡
:B;wrN$EEx)[ aL0
ÔÚÕâƪÎÄÕÂÀÎÒ½«¸æËßÄãÈçºÎʹÓÃDATEADDºÍ ......
MySQLÌṩ±ê×¼µÄSQLģʽƥÅ䣬ÒÔ¼°Ò»ÖÖ»ùÓÚÏóUnixʵÓóÌÐòÈçvi¡¢grepºÍsedµÄÀ©Õ¹ÕýÔò±í´ïʽģʽƥÅäµÄ¸ñʽ¡£ ±ê×¼µÄSQLģʽƥÅä
SQLµÄģʽƥÅäÔÊÐíÄãʹÓÓ_”Æ¥ÅäÈκε¥¸ö×Ö·û£¬¶ø“%”Æ¥ÅäÈÎÒâÊýÄ¿×Ö·û(°üÀ¨Áã¸ö×Ö·û)¡£ÔÚ MySQLÖУ¬SQLµÄģʽȱʡÊǺöÂÔ´óСдµÄ¡£ÏÂÃæÏÔʾһЩÀý×Ó¡£×¢ÒâÔÚÄãÊ ......
һֱûÓÐÕÒµ½Ò»Öֺõķ½·¨À´ÒýÓÃÓзµ»ØÖµµÄ´æ´¢¹ý³ÌµÄ·½·¨£¬Ê¹ÎÒÔÚÌí¼ÓÊý¾ÝÖÐ×ßÁ˲»ÉÙµÄÍä·£¬×î½ü£¬ÔÚ²éÔÄÁË´óÁ¿µÄ×ÊÁÏÖ®ºó£¬ÖÕÓÚÔÚ΢ÈíµÄÒ»¸öʵÀýÖÐÕÒµ½ÁËÒ»ÖÖÁ¼ºÃµÄ·½·¨¡£
Ê×ÏȱàдºÃÒ»Óзµ»ØÖµµÄ´æ´¢¹ý³Ì
create procedure proc_name
@para1 nchar(20), --ÊäÈë²ÎÊý
&n ......
1.´ò¿ªSQL Server Management Studio ExpressÒÔ“WindowsÉí·ÝÈÏÖ¤”µÄ·½Ê½µÇ¼¡£Èçͼ1£º
ͼ1£º
2.ÔÚSQL Server Management Studio ExpressÖеē¶ÔÏó×ÊÔ´¹ÜÀíÆ÷”--“Êý¾Ý¿â”ÉÏÓÒ¼ü--“¸½¼Ó”¡£Èçͼ2£º
ͼ2£º
3.ÔÚµ¯³öÀ´µÄ“¸½¼ÓÊý¾Ý¿â”´°¿ÚÖе¥» ......
table
Num createDate
---------------------------------
(¿Õ) 20090901
(¿Õ) 20090901
  ......