Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

SQL×¢Èë·¨¹¥»÷ Ïê½â

Ëæ×ÅB/SģʽӦÓÿª·¢µÄ·¢Õ¹£¬Ê¹ÓÃÕâÖÖģʽ±àдӦÓóÌÐòµÄ³ÌÐòÔ±Ò²Ô½À´Ô½¶à¡£µ«ÊÇÓÉÓÚ³ÌÐòÔ±µÄˮƽ¼°¾­ÑéÒ²²Î²î²»Æ룬Ï൱´óÒ»²¿·Ö³ÌÐòÔ±ÔÚ±àд´úÂëµÄʱºò£¬Ã»ÓжÔÓû§ÊäÈëÊý¾ÝµÄºÏ·¨ÐÔ½øÐÐÅжϣ¬Ê¹Ó¦ÓóÌÐò´æÔÚ°²È«Òþ»¼¡£Óû§¿ÉÒÔÌá½»Ò»¶ÎÊý¾Ý¿â²éѯ´úÂ룬¸ù
¾Ý³ÌÐò·µ»ØµÄ½á¹û£¬»ñµÃijЩËûÏëµÃÖªµÄÊý¾Ý£¬Õâ¾ÍÊÇËùνµÄSQL Injection£¬¼´SQL×¢Èë¡£
SQL×¢ÈëÊÇ´ÓÕý³£µÄWWW¶Ë¿Ú·ÃÎÊ£¬¶øÇÒ±íÃæ¿´ÆðÀ´¸úÒ»°ãµÄWebÒ³Ãæ·ÃÎÊûʲôÇø±ð£¬ËùÒÔÄ¿Ç°ÊÐÃæµÄ·À»ðǽ¶¼²»»á¶ÔSQL×¢Èë·¢³ö¾¯±¨£¬Èç¹û¹ÜÀíԱû²é¿´IISÈÕÖ¾µÄÏ°¹ß£¬¿ÉÄܱ»ÈëÇֺܳ¤Ê±¼ä¶¼²»»á·¢¾õ¡£µ«ÊÇ£¬SQL×¢ÈëµÄÊÖ·¨Ï൱Áé»î£¬ÔÚ×¢ÈëµÄʱºò»áÅöµ½ºÜ¶àÒâÍâµÄÇé¿ö¡£Äܲ»Äܸù¾Ý¾ßÌåÇé¿ö½øÐзÖÎö£¬¹¹ÔìÇÉÃîµÄSQLÓï¾ä£¬´Ó¶ø³É¹¦»ñÈ¡ÏëÒªµÄÊý¾Ý¡£
¾Ýͳ¼Æ£¬ÍøÕ¾ÓÃASP+Access»òSQLServerµÄÕ¼70%ÒÔÉÏ£¬PHP+MySQÕ¼L20%£¬ÆäËûµÄ²»×ã10%¡£ÔÚ±¾ÎÄ£¬ÒÔSQL-SERVER£«ASPÀý˵Ã÷SQL×¢ÈëµÄÔ­Àí¡¢·½·¨Óë¹ý³Ì¡££¨PHP×¢ÈëµÄÎÄÕÂÓÉNBÁªÃ˵ÄÁíһλÅóÓÑzwell׫дµÄÓйØÎÄÕ£©
SQL×¢Èë¹¥»÷µÄ×ÜÌå˼·ÊÇ£º
l ·¢ÏÖSQL×¢ÈëλÖã»
l ÅжϺǫ́Êý¾Ý¿âÀàÐÍ£»
l È·¶¨XP_CMDSHELL¿ÉÖ´ÐÐÇé¿ö
l ·¢ÏÖWEBÐéÄâĿ¼
l ÉÏ´«ASPľÂí£»
l µÃµ½¹ÜÀíԱȨÏÞ£»
Ò»¡¢SQL×¢È멶´µÄÅжÏ
Ò»°ãÀ´Ëµ£¬SQL×¢ÈëÒ»°ã´æÔÚÓÚÐÎÈ磺HTTP://xxx.xxx.xxx/abc.asp?id=XXµÈ´øÓвÎÊýµÄASP¶¯Ì¬ÍøÒ³ÖУ¬ÓÐʱһ¸ö¶¯Ì¬ÍøÒ³ÖпÉÄÜÖ»ÓÐÒ»¸ö²ÎÊý£¬ÓÐʱ¿ÉÄÜÓÐN¸ö²ÎÊý£¬ÓÐʱÊÇÕûÐͲÎÊý£¬ÓÐʱÊÇ×Ö·û´®ÐͲÎÊý£¬²»ÄÜÒ»¸Å¶øÂÛ¡£×ÜÖ®Ö»ÒªÊÇ´øÓвÎÊýµÄ¶¯Ì¬ÍøÒ³ÇÒ´ËÍøÒ³·ÃÎÊÁËÊý¾Ý¿â£¬ÄÇô¾ÍÓпÉÄÜ´æÔÚSQL×¢Èë¡£Èç¹ûASP³ÌÐòԱûÓа²È«Òâʶ£¬²»½øÐбØÒªµÄ×Ö·û¹ýÂË£¬´æÔÚSQL×¢ÈëµÄ¿ÉÄÜÐԾͷdz£´ó¡£
ΪÁËÈ«ÃæÁ˽⶯̬ÍøÒ³»Ø´ðµÄÐÅÏ¢£¬Ê×Ñ¡Çëµ÷ÕûIEµÄÅäÖᣰÑIE²Ëµ¥-¹¤¾ß-InternetÑ¡Ï¸ß¼¶£­ÏÔʾÓѺÃHTTP´íÎóÐÅϢǰÃæµÄ¹´È¥µô¡£
ΪÁË°ÑÎÊÌâ˵Ã÷Çå³þ£¬ÒÔÏÂÒÔHTTP://xxx.xxx.xxx/abc.asp?p=YYΪÀý½øÐзÖÎö£¬YY¿ÉÄÜÊÇÕûÐÍ£¬Ò²ÓпÉÄÜÊÇ×Ö·û´®¡£
1¡¢ÕûÐͲÎÊýµÄÅжÏ
µ±ÊäÈëµÄ²ÎÊýYYΪÕûÐÍʱ£¬Í¨³£abc.aspÖÐSQLÓï¾äԭò´óÖÂÈçÏ£º
select * from ±íÃû where ×Ö¶Î=YY£¬ËùÒÔ¿ÉÒÔÓÃÒÔϲ½Öè²âÊÔSQL×¢ÈëÊÇ·ñ´æÔÚ¡£
¢ÙHTTP://xxx.xxx.xxx/abc.asp?p=YY’(¸½¼ÓÒ»¸öµ¥ÒýºÅ)£¬´Ëʱabc.ASPÖеÄSQLÓï¾ä±ä³ÉÁË
select * from ±íÃû where ×Ö¶Î=YY’£¬abc.aspÔËÐÐÒì³££»
¢ÚHTTP://xxx.xxx.xxx/abc.asp?p=YY and 1=1, abc.aspÔËÐÐÕý³££¬¶øÇÒÓëHTTP://xxx.xxx.xxx/abc.asp?p=YYÔËÐнá


Ïà¹ØÎĵµ£º

sqlÓï¾ä µÃµ½ sql server ±íÖÐÁеÄÀàÐͺÍ˵Ã÷

ͨ¹ýSqlÓï¾ä»ñµÃ ÁеÄÀàÐͺÍ˵Ã÷:
  µÃµ½µÄ±íÍ·£º±íÃû|ÁÐÃû|ÀàÐÍ|˵Ã÷
  1£ºÕë¶Ôsql server 2000£¬ÔÚsql2000ÖУ¬Ê¹Óãºsysobjects,syscolumnsºÍsysproperties±í
    SELECT o.name as table_name,c.name AS col_name,type_name(c.xtype) AS type_name,isnull(p.value,'') AS col_Pro ......

SQL ×¢Èë¹¥»÷Ô­Àí¼°·À»¤

SQL ×¢Èë¹¥»÷Ô­Àí¼°·À»¤
ÔÚÈ·ÈÏ¿ÉÒÔ×¢ÈëµÄÇé¿öÏ£¬Ê¹ÓÃÏÂÃæµÄÓï¾ä£º
HTTP://www.163.com/news.asp?id=xx ;and (select count(*) from sysobjects)£¾0
HTTP://www.163.com/news.asp?id=xx ;and (select count(*) from msysobjects)£¾0
Èç¹ûÊý¾Ý¿âÊÇSQLServer£¬ÄÇôµÚÒ»¸öÍøÖ·µÄÒ³ÃæÓëÔ­Ò³ÃæHTTP://www.163.com/news.asp? ......

SQLʱ¼äº¯Êý

--ÈÕÆÚת»»²ÎÊý,ÖµµÃÊÕ²Ø
select CONVERT(varchar, getdate(), 120 )2004-09-12 11:06:08
select replace(replace(replace(CONVERT(varchar, getdate(), 120 ),'-',''),' ',''),':','')20040912110608
select CONVERT(varchar(12) , getdate(), 111 )2004/09/12
select CONVERT(varchar(12) , getdate(), 112 )20040912 ......

¡¾Õª¡¿Power Builder Öж¯Ì¬SQLÓï¾äµÄд·¨

PowerBuilderÊÇÄ¿Ç°×îÁ÷ÐеÄÊý¾Ý¿â¿ª·¢¹¤¾ßÖ®Ò»¡£PowerBuilderÌṩÁËÔÚ³ÌÐò´úÂëÖмÓÈëǶÈëʽSQLÓï¾äµÄ¹¦ÄÜÀ´Ö§³Ö¶ÔÊý¾Ý¿âµÄ·ÃÎÊ¡£µ«ÕâÖÖǶÈëʽSQLÓï¾äÖ»ÄÜÖ§³ÖһЩ¹Ì¶¨µÄ±ê×¼µÄSQLÓï¾ä£¬¼´ÔÚ½øÐгÌÐò´úÂë±àÒë´¦ÀíʱÕâЩSQLÓï¾ä±ØÐëÊÇÈ·¶¨µÄ£¬ÀýÈ磺¶ÔÄÄÕűíÄļ¸¸ö×ֶνøÐвÙ×÷ÔÚ³ÌÐò´úÂëÖÐÊǹ̶¨Ð´Ã÷µÄ£¬ÁíÍâÕâÖÖ·½Ê½Ò²²»ÄÜ ......

sql group by Óë havingµÄÓ÷¨

1. GROUP BY ÊÇ·Ö×é²éѯ, Ò»°ã GROUP BY ÊǺ;ۺϺ¯ÊýÅäºÏʹÓÃ
group by ÓÐÒ»¸öÔ­Ôò,¾ÍÊÇ select ºóÃæµÄËùÓÐÁÐÖÐ,ûÓÐʹÓþۺϺ¯ÊýµÄÁÐ,±ØÐë³öÏÖÔÚ group by ºóÃ棨ÖØÒª£©
ÀýÈç,ÓÐÈçÏÂÊý¾Ý¿â±í£º
A    B
1    abc
1    bcd
1    asdfg
 Èç¹ûÓÐÈ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ