SQL SERVER´¥·¢Æ÷»Ö¸´·½·¨¡¢·þÎñÆ÷
´¥·¢Æ÷
´¥·¢Æ÷ÊÇÒ»ÖÖÌØÊâÀàÐ͵Ĵ洢¹ý³Ì£¬Ëü²»Í¬Ç°Ãæ½éÉܹýµÄ´æ´¢¹ý³Ì¡£´¥·¢Æ÷Ö÷ÒªÊÇͨ¹ýʼþ½øÐд¥·¢¶ø±»Ö´Ðеģ¬¶ø´æ´¢¹ý³Ì¿ÉÒÔͨ¹ý´æ´¢¹ý³ÌÃû³Æ¶ø±»Ö±½Óµ÷Óᣴ¥·¢Æ÷ÊÇÒ»¸ö¹¦ÄÜÇ¿´óµÄ¹¤¾ß£¬Ëüʹÿ¸öÕ¾µã¿ÉÒÔÔÚÓÐÊý¾ÝÐÞ¸Äʱ×Ô¶¯Ç¿ÖÆÖ´ÐÐÆäÒµÎñ¹æÔò¡£´¥·¢Æ÷¿ÉÒÔÓÃÓÚSQL ServerÔ¼Êø¡¢Ä¬ÈÏÖµºÍ¹æÔòµÄÍêÕûÐÔ¼ì²é¡£
µ±Íùijһ¸ö±í¸ñÖвåÈë¼Ç¼¡¢Ð޸ļǼ»òÕßɾ³ý¼Ç¼ʱ£¬SQL Server¾Í»á×Ô¶¯Ö´Ðд¥·¢Æ÷Ëù¶¨ÒåµÄSQLÓï¾ä£¬´Ó¶øÈ·±£¶ÔÊý¾ÝµÄ´¦Àí±ØÐë·ûºÏÓÉÕâЩSQLÓï¾äËù¶¨ÒåµÄ¹æÔò¡£ÔÚ´¥·¢Æ÷ÖпÉÒÔ²éѯÆäËû±í¸ñ»òÕß°üÀ¨¸´ÔÓµÄSQLÓï¾ä¡£´¥·¢Æ÷ºÍÒýÆð´¥·¢Æ÷Ö´ÐеÄSQLÓï¾ä±»µ±×÷Ò»´ÎÊÂÎñ´¦Àí£¬Èç¹ûÕâ´ÎÊÂÎñδ»ñµÃ³É¹¦£¬SQL Server»á×Ô¶¯·µ»Ø¸ÃÊÂÎñÖ´ÐÐÇ°µÄ״̬¡£ºÍCHECKÔ¼ÊøÏà±È½Ï£¬´¥·¢Æ÷¿ÉÒÔÇ¿ÖÆʵÏÖ¸ü¼Ó¸´ÔÓµÄÊý¾ÝÍêÕûÐÔ£¬¶øÇÒ¿ÉÒԲο¼ÆäËû±íµÄ×ֶΡ£ËüµÄÖ÷ÒªÓŵãÈçÏ£º
(1)´¥·¢Æ÷ÊÇ×Ô¶¯µÄ¡£µ±¶Ô±íÖеÄÊý¾Ý×÷ÁËÈκÎÐÞ¸Ä(±ÈÈçÊÖ¹¤ÊäÈë»òÕßÓ¦ÓóÌÐò²ÉÈ¡µÄ²Ù×÷)Ö®ºóÁ¢¼´±»¼¤»î¡£
(2)´¥·¢Æ÷¿ÉÒÔͨ¹ýÊý¾Ý¿âÖеÄÏà¹Ø±í½øÐвãµþ¸ü¸Ä¡£È磬¿ÉÒÔÔÚtitles±íµÄtitle-idÁÐÉÏдÈëÒ»¸öɾ³ý´¥·¢Æ÷£¬ÒÔʹÆäËû±íÖеĸ÷Æ¥ÅäÐвÉȡɾ³ý²Ù×÷¡£¸Ã´¥·¢Æ÷ÓÃtitle-idÁÐ×÷ΪΩһ¼ü£¬ÔÚtitleauthor¡¢sales¼°roysched±íÖжԸ÷Æ¥ÅäÐнøÐж¨Î»¡£
(3)´¥·¢Æ÷¿ÉÒÔÇ¿ÖÆÏÞÖÆ¡£ÕâЩÏÞÖƱÈÓÃCHECKÔ¼ÊøËù¶¨ÒåµÄ¸ü¸´ÔÓ¡£ÓëCHECKÔ¼Êø²»Í¬µÄÊÇ£¬´¥·¢Æ÷¿ÉÒÔÒýÓÃÆäËü±íÖеÄÁС£ÀýÈ磬´¥·¢Æ÷¿ÉÒԻعöÊÔͼ¶Ô¼Û¸ñµÍÓÚ10ÃÀÔªµÄÊé(´æ´¢ÔÚtitle±íÖÐ)Ó¦ÓÃÕÛ¿Û(´æ´¢ÔÚdiscounts±íÖÐ)µÄ¸üС£
Ò»¡¢´´½¨´¥·¢Æ÷
ÔÚSQL ServerÖУ¬¿ÉÒÔʹÓÃÆóÒµ¹ÜÀíÆ÷»òÕßTransact-SQLÓï¾äÀ´´´½¨´¥·¢Æ÷¡£ÔÚ´´½¨´¥·¢Æ÷֮ǰӦ¸Ã¿¼ÂÇÒÔϼ¸¸öÎÊÌ⣺
(1)CREATE TRIGGERÓï¾ä±ØÐëÊÇÅú´¦ÀíÖеĵÚÒ»¸öÓï¾ä¡£½«¸ÃÅú´¦ÀíÖÐËæºóµÄÆäËüËùÓÐÓï¾ä½âÊÍΪCREATE TRIGGERÓï¾ä¶¨ÒåµÄÒ»²¿·Ö¡£
(2)´´½¨´¥·¢Æ÷µÄȨÏÞĬÈÏ·ÖÅä¸ø±íµÄËùÓÐÕߣ¬ÇÒ²»Äܽ«¸ÃȨÏÞת¸øÆäËûÓû§¡£
(3)´¥·¢Æ÷ΪÊý¾Ý¿âµÄ¶ÔÏó£¬ÆäÃû³Æ±ØÐë×ñѱêʶ·ûµÄÃüÃû¹æÔò¡£
(4)ËäÈ»´¥·¢Æ÷¿ÉÒÔÒýÓõ±Ç°Êý¾Ý¿âÒÔÍâµÄ¶ÔÏ󣬵«Ö»ÄÜÔÚµ±Ç°Êý¾Ý¿âÖд´½¨´¥·¢Æ÷¡£
(5)ËäÈ»²»ÄÜÔÚÁÙʱ±í»òϵͳ±íÉÏ´´½¨´¥·¢Æ÷£¬µ«ÊÇ´¥·¢Æ÷¿ÉÒÔÒýÓÃÁÙʱ±í¡£²»Ó¦ÒýÓÃϵͳ±í£¬¶øӦʹÓÃÐÅÏ¢¼Ü¹¹ÊÓͼ¡£Óйظü¶àÐÅÏ¢£¬Çë²Î¼ûÐÅÏ¢¼Ü¹¹ÊÓͼ¡£
(6)ÔÚº¬ÓÐÓÃDELETE»òUPDATE²Ù×÷¶¨ÒåµÄÍâ¼üµÄ±íÖУ¬²»Äܶ¨ÒåINSTEAD OFºÍINSTEAD OF UPDATE´¥·¢Æ÷¡£
(7)ËäÈ»TRUNCATE TABLEÓï¾äÀàËÆÓÚûÓÐWHERE×ÓÃû(ÓÃÓÚɾ³ýÐÐ)µÄDELETEÓï¾ä£¬µ«
Ïà¹ØÎĵµ£º
ÔÎÄת×Ô http://blog.csdn.net/jyh_jack/archive/2008/04/07/2257512.aspx
SQL Native Client ODBC Driver
±ê×¼°²È«Á¬½Ó
Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
ÄúÊÇ·ñÔÚʹÓÃSQL Server 2005 Express£¿ Çë ......
ÔÚOracleÖУ¬Èç¹ûÔÚsqlÖгöÏÖ'&'·ûºÅ£¬»á±»×Ô¶¯×ªÒ壻
¶ø±»ÒªÇóÊäÈëÔÚ&·ûºÅºó¸úËæµÄ×Ö·û´®µÄÖµ£¬ÀýÈ磺
update tablename set columnName='http://www.g.cn/cv2.jsp?spid=222&cid=333';
Ö´ÐÐÕâ¸ö²Ù×÷ʱ£¬Oracle»áÌáʾ
Enter value for cid:
ÔÒòÊÇÔÚOracleÖÐ & ·ûºÅÊÇ×÷ΪתÒå×Ö·ûʹÓõġ£
½â¾ö·½·¨ ......
ÕâЩº¯ÊýÔÚϵͳº¯Êý¿ÉÒÔÕÒµ½¡£ÏÂÃæÊÇÎÒÁ·Ï°Ê±Ð´µÄ´úÂ룬°üº¬Á˳£ÓõÄ×Ö·û´®²Ù×÷º¯Êý
/*********************************
³£ÓÃ×Ö·û´®º¯Êý:sqlÖÐûÓÐÊý×éÕâһ˵
*********************************/
--int charindex('ÒªÕÒµÄ×Ö·û´®','Ô´×Ö·û´®',¿ªÊ¼Î»ÖÃ)£¬»ñÈ¡×Ö·û´®ÖÐÖ¸¶¨×Ö·û´®µÄλÖÃ
declare @str varchar(50)
set ......
ÔÚƽʱµÄ¹¤×÷¹ý³ÌÖУ¬×÷ΪDBA½ÇÉ«¹ÜÀíÊý¾Ý¿â£¬Í·ÄÔÖеÄÓ¡ÏóÍùÍùÊÇÊý¾Ý¿âʵÀýÃû³Æ£¬¶ø²»»áÈ¥¹ØÐÄServerµÄIP£¬¶ø×÷ΪDeveloperµÄ½ÇÉ«£¬ËûÃÇÍùÍùÏëÖªµÀÖªµÀServer IpºÍ¶Ë¿ÚºÅ¡£ËùÒÔ£¬DBA»á¾³£±»Îʼ°µ½£ºXXXʵÀýµÄIPºÍ¶Ë¿ÚºÅÊÇʲô£¿
Õâ¸öÎÊÌ⣬µ±È»ÎÒÃÇ¿ÉÒÔLoginµ½OS²é¿´IP¡¢Ê¹ÓÃÅäÖƹÜÀí¹¤¾ß»ñÈ¡µ½¶Ë¿ÚºÅ¡£µ«ÊÇ£¬Õâ¸ö·½·¨·Ç ......
ͼ±í
ͼ±í(ÓֳƹØϵͼ)ÊÇSQL ServerÖÐÒ»ÀàÌØÊâµÄÊý¾Ý¿â¶ÔÏó£¬ËüÌṩ¸øÓû§Ö±¹ÛµØ¹ÜÀíÊý¾Ý¿â±íµÄ·½·¨¡£Í¨¹ýͼ±í£¬Óû§¿ÉÒÔÖ±¹ÛµØ´´½¨¡¢±à¼Êý¾Ý¿â±íÖ®¼äµÄ¹Øϵ£¬Ò²¿ÉÒÔ±à¼±í¼°ÆäÁеÄÊôÐÔ¡£ÀûÓÃÆóÒµ¹ÜÀíÆ÷´´½¨Í¼±íµÄ¾ßÌå²½ÖèÈçÏ£º
(1)ÔÚÆóÒµ¹ÜÀíÆ÷ÖУ¬Õ¹¿ªÖ¸¶¨µÄ·þÎñÆ÷ºÍÊý¾Ý¿â£¬´ò¿ªÒª½¨Á¢µÄͼ±íËùÔÚµÄÊý¾Ý¿â£¬ÓÒ»÷ͼ±íÍ ......