SQL×¢Èë¹¥»÷µÄÔÀí¼°Æä·À·¶´ëÊ©
ת£ºhttp://blog.csdn.net/flyfranker/archive/2009/01/08/3733764.aspx
ASP±à³ÌÃż÷ºÜµÍ£¬ÐÂÊÖºÜÈÝÒ×ÉÏ·¡£ÔÚÒ»¶Î²»³¤µÄʱ¼äÀÐÂÊÖÍùÍù¾ÍÒѾÄܹ»±à³ö¿´À´±È½ÏÍêÃÀµÄ¶¯Ì¬ÍøÕ¾£¬ÔÚ¹¦ÄÜÉÏ£¬ÀÏÊÖÄÜ×öµ½µÄ£¬ÐÂÊÖÒ²Äܹ»×öµ½¡£ÄÇôÐÂÊÖÓëÀÏÊÖ¾ÍûÇø±ðÁËÂð£¿ÕâÀïÃæÇø±ð¿É¾Í´óÁË£¬Ö»²»¹ýÍâÐÐÈ˺ÜÄÑÒ»Ñ۾Ϳ´³öÀ´°ÕÁË¡£ÔÚ½çÃæµÄÓѺÃÐÔ¡¢ÔËÐÐÐÔÄÜÒÔ¼°ÍøÕ¾µÄ°²È«ÐÔ·½ÃæÊÇÐÂÊÖÓëÀÏÊÖÖ®¼äÇø±ðµÄÈý¸ö¼¯Öе㡣¶øÔÚ°²È«ÐÔ·½Ã棬ÐÂÊÖ×îÈÝÒ׺öÂÔµÄÎÊÌâ¾ÍÊÇSQL×¢È멶´µÄÎÊÌâ¡£ÓÃNBSI 2.0¶ÔÍøÉϵÄһЩASPÍøÕ¾ÉÔ¼ÓɨÃ裬¾ÍÄÜ·¢ÏÖÐí¶àASPÍøÕ¾´æÔÚSQL×¢È멶´£¬½ÌÓýÍøÀï¸ßУÄÚ²¿»ú¹¹µÄһЩÍøÕ¾ÕâÖÖ©¶´¾Í¸üÆÕ±éÁË£¬¿ÉÄÜÕâÊÇÒòΪÕâЩÍøÕ¾´ó¶¼ÊÇһЩѧÉú×öµÄÔµ¹Ê°É£¬ËäÈ»¸ö¸ö¶¼ºÜ´ÏÃ÷£¬¿ÉÊDZϾ¹Ã»ÓоÑ飬¶øÇÒ´¦ÓÚѧϰÖУ¬ÄÑÃ⩶´¶à¶àÁË¡£±¾ÎÄÖ÷Òª½²½²SQL×¢ÈëµÄ·À·¶´ëÊ©£¬¶øÒªÃ÷°×ÕâЩ·À·¶´ëÊ©µÄÓô¦£¬ÐëÏÈÏêϸ½²½âÀûÓÃSQL×¢È멶´ÈëÇֵĹý³Ì¡£ÐÂÊÖÃÇ¿´Ã÷°×À²¡£
¡¡¡¡Ï൱´óÒ»²¿·Ö³ÌÐòÔ±ÔÚ±àд´úÂëµÄʱºò£¬Ã»ÓжÔÓû§ÊäÈëÊý¾ÝµÄºÏ·¨ÐÔ½øÐÐÅжϣ¬Ê¹Ó¦ÓóÌÐò´æÔÚ°²È«Òþ»¼¡£ÈçÕâÊÇÒ»¸öÕý³£µÄÍøÖ·http://localhost/lawjia/show.asp?ID=444£¬½«Õâ¸öÍøÖ·Ìá½»µ½·þÎñÆ÷ºó£¬·þÎñÆ÷½«½øÐÐÀàËÆSelect * from ±íÃû where ×Ö¶Î="&IDµÄ²éѯ(ID¼´¿Í»§¶ËÌá½»µÄ²ÎÊý£¬±¾ÀýÊǼ´444)£¬ÔÙ½«²éѯ½á¹û·µ»Ø¸ø¿Í»§¶Ë£¬Èç¹ûÕâÀï¿Í»§¶Ë¹ÊÒâÌá½»Õâôһ¸öÍøÖ·£º
¡¡¡¡http://localhost/lawjia/show.asp?ID=444 and user>0£¬Õâʱ£¬·þÎñÆ÷ÔËÐÐSelect * from ±íÃû where ×Ö¶Î=444 and user>0ÕâÑùµÄ²éѯ£¬µ±È»£¬Õâ¸öÓï¾äÊÇÔËÐв»ÏÂÈ¥µÄ£¬¿Ï¶¨³ö´í£¬´íÎóÐÅÏ¢ÈçÏ£º
¡¡¡¡·´íÎóÀàÐÍ£º
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC SQL Server Driver][SQL Server]½« nvarchar Öµ 'sonybb' ת»»ÎªÊý¾ÝÀàÐÍΪ int µÄÁÐʱ·¢ÉúÓï·¨´íÎó¡£
/lawjia/show.asp, µÚ 47 ÐÐ
¡¡¡¡µ«ÊDZðÓÐÓÃÐĵÄÈË´ÓÕâ¸ö³ö´íÐÅÏ¢ÖУ¬¿ÉÒÔ»ñµÃÒÔÏÂÐÅÏ¢£º¸ÃվʹÓÃMS£ßSQLÊý¾Ý¿â£¬ÓÃODBCÁ¬½Ó£¬Á¬½ÓÕʺÅÃûΪ£ºsonybb¡£ËùνSQL×¢È루SQL Injection£©£¬¾ÍÊÇÀûÓóÌÐòÔ±¶ÔÓû§ÊäÈëÊý¾ÝµÄºÏ·¨ÐÔ¼ì²â²»ÑÏ»ò²»¼ì²âµÄÌص㣬¹ÊÒâ´Ó¿Í»§¶ËÌá½»ÌØÊâµÄ´úÂ룬´Ó¶øÊÕ¼¯³ÌÐò¼°·þÎñÆ÷µÄÐÅÏ¢£¬´Ó¶ø»ñÈ¡ÏëµÃµ½µÄ×ÊÁÏ¡£Í¨³£±ðÓÐÓÃÐÄÕßµÄÄ¿±êÊÇ»ñÈ¡ÍøÕ¾¹ÜÀíÔ±µÄÕʺźÍÃÜÂë¡£±ÈÈ統ij¸öÈËÖªµÀÍøÕ¾¹ÜÀíÔ±ÕʺŴæÔÚ±íloginÖУ¬¹ÜÀíÔ±ÕʺÅÃûΪadmin£¬ËûÏëÖªµÀ¹ÜÀíÔ±ÃÜÂ룬ÕâÀïËû´Ó¿Í»§¶Ë½Ó×ÅÌá½»ÕâÑùÒ»¸öÍøÖ
Ïà¹ØÎĵµ£º
update CHELIANG_MINGDAN set clmd_yunxuzaizhong = cast(clmd_yunxuzaizhong/1000 as decimal(14,4)) where clmd_yunxuzaizhong is not null
update CHELIANG_MINGDAN set clmd_carweight = cast(clmd_carweight/1000 as decimal(14,4)) where clmd_carweight is not null ......
SQL ÖÐµÄ substring º¯ÊýÊÇÓÃÀ´×¥³öÒ»¸öÀ¸Î»×ÊÁÏÖеÄÆäÖÐÒ»²¿·Ö¡£Õâ¸öº¯ÊýµÄÃû³ÆÔÚ²»Í¬µÄ×ÊÁÏ¿âÖв»ÍêÈ«Ò»Ñù£º
MySQL: SUBSTR(), SUBSTRING()
Oracle: SUBSTR()
SQL Server: SUBSTRING()
×î³£Óõ½µÄ·½Ê½ÈçÏ (ÔÚÕâÀïÎÒÃÇÓÃSUBSTR()ΪÀý)£º
SUBSTR(str,pos): ÓÉ<str>ÖУ¬Ñ¡³öËùÓдӵÚ<pos>λÖÿªÊ¼ ......
Áª½ÓÌõ¼þ¿ÉÔÚ from »ò WHERE ×Ó¾äÖÐÖ¸¶¨£¬½¨ÒéÔÚ from ×Ó¾äÖÐÖ¸¶¨Áª½ÓÌõ¼þ¡£WHERE ºÍ HAVING ×Ó¾äÒ²¿ÉÒÔ°üº¬ËÑË÷Ìõ¼þ£¬ÒÔ½øÒ»²½É¸Ñ¡Áª½ÓÌõ¼þËùÑ¡µÄÐС£
Áª½Ó¿É·ÖΪÒÔϼ¸Àࣺ   ......
¡¡Ç°Ì᣺°²×°sqlserver£¬°²×°outlook£¬outlookÒѾÕýÈ·ÅäÖá£
£¨1£©ÅäÖÃsqlserverµÄÆô¶¯Óû§ÎªÓòÓû§¡£sqlserverÆô¶¯Ä¬Èϵı¾µØÕË»§£¬±¾µØÕË»§Æô¶¯µÄ·þÎñÊÇÎÞ·¨Íê³ÉÓʼþµÄ·¢ËͽÓÊܹ¦Äܵġ£
ÅäÖÃÓòÓû§Æô¶¯£º´ò¿ª¿ØÖÆÃæ°åµÄ--¹ÜÀí¹¤¾ß--·þÎñ£¬ÕÒµ½sqlserver·þÎñ£¬²é¿´ÊôÐÔ¡£Ô ......
sql±àÒëÓëÖرàÒë
1.sp_recompile
ʹ´æ´¢¹ý³ÌºÍ´¥·¢Æ÷ÔÚÏ´ÎÔËÐÐʱÖØбàÒë¡£
2.sp_refreshview
Èç¹ûÊÓͼËùÒÀÀµµÄ»ù´¡¶ÔÏó·¢Éú¸ü¸Ä(Èç:±íÔö¼ÓÁËÒ»¸ö×Ö¶Î)£¬ÔòÊÓͼ²»»á×Ô¶¯¸üУ¬ÕâʱÐèÒªµ÷Óøô洢¹ý³ÌÀ´¶ÔÊÓͼ½øÐÐˢС£ÓÐÈË˵£¬ÖØдò¿ªÒ»ÏÂÊÓͼ¾Í¿ÉÒÔ¸üÐÂÊÓͼ£¬µ«ÎÒÊÔÁËûÓгɹ¦¡£
Àý1£ºË¢ÐÂÖ¸¶¨Ãû³ÆµÄÊÓͼ
......