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

MSSQLÊý¾Ý¿âÖз¢ÏÖD99_tmp±íµÄ´¦Àí·½·¨

ÏàÐźܶàASP+MSSQLµÄÍøÕ¾¶¼Óб»ÈË×¢Èë¹ýµÄ¾­Àú£¬Êý¾Ý¿â±íÖжàÁËһЩ±í£¬ÀàËÆÒÔϵıíD99_tmp,D99_cmd£¬kill_kk¡£
D99_tmp£¨subdirectory,depth,fileÈý¸ö×ֶΣ¬ÀïÃæµÄÊý¾Ý¶¼ÊÇÍøÕ¾ÎļþºÍĿ¼£©
MSSQLÊý¾Ý¿â´æÔÚ¼¸¸öΣÏÕµÄÀ©Õ¹´æ´¢¹ý³Ì£¬Ä¬ÈÏPublic×é¿ÉÖ´ÐÐȨÏÞ£¬SQL×¢ÈëÕß¿ÉÀûÓô˶ÁÈ¡ÎļþĿ¼¼°Óû§×飬²¢¿Éͨ¹ýÏÈдÈëÊý¾Ý¿âÈ»ºóµ¼³öΪÎļþµÄ·½·¨Íù·þÎñÆ÷дÈëΣÏսű¾½øÒ»²½ÌáȨ£¬»òÖ±½ÓʹÓÃijЩ´æ´¢¹ý³ÌÖ´ÐÐÃüÁÈçxp_cmdshell¡£
xp_cmdshell¿ÉÒÔÈÃϵͳ¹ÜÀíÔ±ÒÔ²Ù×÷ϵͳÃüÁîÐнâÊÍÆ÷µÄ·½Ê½Ö´Ðиø¶¨µÄÃüÁî×Ö·û´®£¬²¢ÒÔÎı¾Ðз½Ê½·µ»ØÈκÎÊä³ö£¬ÊÇÒ»¸ö¹¦Äܷdz£Ç¿´óµÄÀ©Õ¹´æ´¢¹ý³Ì¡£Ò»°ãµÄºÚ¿Í¹¥»÷SQL
Serverʱ£¬Ê×ÏȲÉÓõķ½·¨ÊÇÖ´ÐÐmasterÀ©Õ¹´æ´¢¹ý³Ìxp_cmdshellÃüÁîÀ´ÆÆ»µÊý¾Ý¿â£¬ÎªÁËÊý¾Ý¿â°²È«Æð¼û£¬×îºÃ½ûֹʹÓÃxp_cmdShell.
Ò»°ãÇé¿öÏ£¬xp_cmdshell¶Ô¹ÜÀíÔ±À´ËµÒ²ÊDz»±ØÒªµÄ£¬xp_cmdshellµÄÏû³ý²»»á¶ÔServerÔì³ÉÈκÎÓ°Ïì¡£
¿ÉÒÔ½«xp_cmdshellÏû³ý£º
Use Master
Exec sp_dropextendedproc N 'xp_cmdshell'
Go
Èç¹ûÐèÒªµÄ»°£¬¿ÉÒÔ°Ñxp_cmdshell»Ö¸´»ØÀ´£º
Use Master
Exec sp_addextendedproc N
'xp_cmdshell',N 'xplog70.dll'
Go
¿ÉÒÔÏû³ýµÄ´æ´¢¹ý³ÌÈçÏ£º
sp_makewebtask
xp_cmdshell
xp_dirtree
xp_fileexist
xp_terminate_process
sp_oamethod
sp_oacreate
xp_regaddmultistring
xp_regdeletekey
xp_regdeletevalue
xp_regenumkeys
xp_regenumvalues
sp_add_job
sp_addtask
xp_regread
xp_regwrite
xp_readwebtask
xp_makewebtask
xp_regremovemultistring
¶ÔÓ¦´ëÊ©£ºÉ¾³ýÉÏÊö´æ´¢¹ý³Ì»ò¿ÉÖ´ÐÐÎļþ»òÐ޸Ĵ洢¹ý³ÌÏàÓ¦Óû§×é¿ÉÖ´ÐÐȨÏÞ£¬É¾³ýÉÏÊö´æ´¢¹ý³Ì¶ÔÓ¦½Å±¾Îª£º
drop PROCEDURE
sp_makewebtask
exec master..sp_dropextendedproc xp_cmdshell
exec
master..sp_dropextendedproc xp_dirtree
exec master..sp_dropextendedproc
xp_fileexist
exec master..sp_dropextendedproc xp_terminate_process
exec
master..sp_dropextendedproc sp_oamethod
exec master..sp_dropextendedproc
sp_oacreate
exec master..sp_dropextendedproc xp_regaddmultistring
exec
master..sp_dropextendedproc xp_regdeletekey
exec master..sp_dropextendedproc
xp_regdeletevalue
exec master..sp_dropextendedproc xp_regenumkeys
exec
master..


Ïà¹ØÎĵµ£º

ASP²ÉÓÃODBCÊý¾ÝÔ´Á¬½ÓMSSQLÊý¾Ý¿âÏêϸ˵Ã÷¡¾ÊµÓá¿

ODBCÊý¾ÝÔ´¿É·ÖΪ“ϵͳÐÍ”ºÍ“ÎļþÐÍ”£¬ËûÃǵÄÇø±ðÔÚÓړϵͳÐÍ”ÊÇÁ¬½ÓÊý¾Ý¿âµÄÐÅÏ¢½¨Á¢Ôړϵͳע²á±í”À“ÎļþÐÍ”ÔòÊÇÒÔdsnÎļþÐÎʽ´æ´¢ÔÚODBCÔ´µÄĿ¼ÏÂÃæ
Ò»¡¢½¨Á¢ODBCÊý¾ÝÔ´µÄ·½·¨£º
¿ØÖÆÃæ°å - ¹ÜÀí¹¤¾ß - Êý¾ÝÔ´£¨ODBC£©
´ò¿ªODBCÊý¾ÝÔ´¹ÜÀíÆ÷£¬È»ºóÒ ......

ʵÏÖ¶àÐкϲ¢Ò»ÐеÄSQL [MSSQL2005]д·¨

--1. ´´½¨±í£¬Ìí¼Ó²âÊÔÊý¾Ý
CREATE TABLE tb(id int, [value] varchar(10))
INSERT tb SELECT 1, 'aa'
UNION ALL SELECT 1, 'bb'
UNION ALL SELECT 2, 'aaa'
UNION ALL SELECT 2, 'bbb'
UNION ALL SELECT 2, 'ccc'
--SELECT * from tb
/**//*
id value
----------- ----------
1 aa
1 bb
2 aaa ......

mssqlÖÐÓÃxmlµÄ·½·¨²ð·ÖÒÔ²»¶¨¿Õ¸ñΪ·Ö¸î·ûºÅµÄ×Ö·û´®

---xml²ð·ÖÒÔ²»¶¨¿Õ¸ñΪ·Ö¸î·ûºÅµÄ×Ö·û´®
--²âÊÔÊý¾Ý
if object_id('[tb]') is not null drop table [tb]
create table [tb]([a] varchar(200))
go
insert [tb]
select 'aaaa  bbbb cccc        dddd'
insert [tb]
select 'eeeeee  ffff hhhh     ......

MSSQLµÄ¶à²ãǶÌײéѯ

½ñÌìÔÚÁÄÌìϵͳÖÐÐèҪϵͳִÐÐÒ»¸ö¶à²ãǶÌײéѯ¡£
Ò»¿ªÊ¼Óï¾äÈçÏÂ×ܳöÏÖ´íÎó£ºÔ­À´ÊÇÔÚ]='123') ºóÎÒ¶à¼ÓÁËÒ»¸ö as tb1
¸ÄΪÈçϺó£¬ÕýÈ·ÔËÐС£
select * from ( select top(10)  * from ( select top(100)  * from (select  [chatcontent].[senderid],[chatcontent].[id] ,[chatcontent].[toid] ,[chatc ......

»ùÓÚmssql °ÙÍò¼¶ Êý¾Ý ²éѯ ÓÅ»¯ ¼¼ÇÉÈýÊ®Ôò

1.¶Ô²éѯ½øÐÐÓÅ»¯£¬Ó¦¾¡Á¿±ÜÃâÈ«±íɨÃ裬Ê×ÏÈÓ¦¿¼ÂÇÔÚ where ¼° order by Éæ¼°µÄÁÐÉϽ¨Á¢Ë÷Òý¡£
2.Ó¦¾¡Á¿±ÜÃâÔÚ where ×Ó¾äÖжÔ×ֶνøÐÐ null ÖµÅжϣ¬·ñÔò½«µ¼ÖÂÒýÇæ·ÅÆúʹÓÃË÷Òý¶ø½øÐÐÈ«±íɨÃ裬È磺
select id from t where num is null
¿ÉÒÔÔÚnumÉÏÉèÖÃĬÈÏÖµ0£¬È·±£±íÖÐnumÁÐûÓÐnullÖµ£¬È»ºóÕâÑù²éѯ£º
select id ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ