SQLServerÅúÁ¿µ¹ÈëĿ¼Îļþ ÊÕ²Ø
	
    
    
	
¿ÉÒÔÓÃÀ©Õ¹´æ´¢¹ý³Ìxp_dirtree»ñÈ¡ÎļþÁÐ±í£¬ÓÃopenrowsetµ¹ÈëÊý¾Ýµ½¶þ½øÖÆ×ֶΡ£
openrowsetµÄÓ÷¨¿ÉÒԲο¼msdn
http://technet.microsoft.com/zh-cn/library/ms190312.aspx 
Èç¹ûÎļþºÜ¶à£¬½¨Ò黹ÊÇÓóÌÐòµ¹ÈëÁË
if (object_id ('t_bulkResult' ) is   not   null )
drop table t_bulkResult 
create table t_bulkResult (name varchar (1000 ), data image )
go 
declare @d varchar (1000 )
set @d = 'c:\test\' 
create table #tb (fName varchar (1000 ), d int , f int )
insert into #tb exec xp_dirtree @d , 1 , 1 
delete from #tb where f <> 1 
declare @ sql nvarchar (max )
select @ sql = isnull (@ sql , '' )+ 'insert into t_bulkResult select ''' +@d + fname + ''',* from openrowset(bulk N''' +@d + fName + ''', SINGLE_BLOB) b 
' 
from #tb a 
exec sp_executesql @ sql 
drop table #tb 
select * from t_bulkResult 
    
     
	
	
    
    
	Ïà¹ØÎĵµ£º
        
    
    
ÒýÓÃ×Ôhttp://blog.163.com/xing_aixin/blog/static/3723550520088189201623/
ÍøÉÏÓкܶàSQL ServerÊý¾Ý¿â×ÖµäµÄSQLÓï¾ä£¬ÆßÁã°ËÂ䣬ÎÒÔÚ¹¤×÷ÕûÀíÁËÒ»ÏÂ˼·£¬×ܽáSQL´úÂëÈçÏ¡£Êý¾Ý¿â×Öµä°üÀ¨±í½á¹¹(·Ö2KºÍ2005)¡¢Ë÷ÒýºÍÖ÷¼ü. Íâ¼ü.Ô¼Êø.ÊÓͼ.º¯Êý.´æ´¢¹ý³Ì.´¥·¢Æ÷¡£¿ÉÒÔÔÚÆóÒµ¹ÜÀíÆ÷¡¢²éѯ·ÖÎöÆ÷Öмòµ¥Ö´ÐУ¬Ö±½ÓÁ˵±µ ......
	
    
        
    
    »ñÈ¡sqlserverÊý¾Ý¿âÖÐËùÓп⡢±í¡¢×Ö¶ÎÃûµÄ·½·¨
2009Äê03ÔÂ12ÈÕ ÐÇÆÚËÄ ÏÂÎç 12:51
1.»ñÈ¡ËùÓÐÊý¾Ý¿âÃû: 
SELECT Name from Master..SysDatabases ORDER BY Name 
2.»ñÈ¡ËùÓбíÃû: 
SELECT Name from DatabaseName..SysObjects Where XType='U' ORDER BY Name 
XType='U':±íʾËùÓÐÓû§±í; 
XType='S':±íʾËùÓÐϵͳ± ......
	
    
        
    
    create proc P_QuerySplit
 @sqlscript varchar(20),         --±íÃû/SQLÓï¾ä
 @pageSize int,                  --ÿҳ¼Ç¼Êý
 @pageIndex int,   &nbs ......
	
    
        
    
    SqlserverµÃµ½ºº×ÖÆ´ÒôÊ××Öĸ´æ´¢¹ý³Ì:
create function [dbo].[fun_getPY]
(
@str nvarchar(4000)
)
returns nvarchar(4000)
as
begin
declare @word nchar(1),@PY nvarchar(4000)
set @PY=''
while len(@str)>0
begin
   set @word=left(@str,1)
   --Èç¹û·Çºº×Ö×Ö·û£¬·µ»ØÔ×Ö·û
& ......