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
Ïà¹ØÎĵµ£º
1£©Ð½¨Êý¾Ý¿âRESTORE
2£©ÔÚ¸ÃÊý¾Ý¿âÉÏÑ¡Ôñ£ºÈÎÎñ->»¹Ô->Êý¾Ý¿â
3£©ÔÚ»¹ÔÊý¾Ý¿â-RESTOREµÄ¶Ô»°¿òÖÐ
Ä¿±êÊý¾Ý¿âÊÇRESTORE
Ö¸¶¨ÓÃÓÚ»¹ÔµÄ±¸·Ý¼¯µÄÔ´ºÍλÖÃ->Ô´É豸->Ñ¡Ôñ×îºóÒ»¸öÍêÈ«µÄ±¸·ÝBAKÎļþ
¹´Öл¹ÔCheckBox
4£©Ñ¡Ôñ×óÉϽǵÄÑ¡Ïî
ÔÚ»¹ÔÑ ......
±¾ÆªÄÚÈÝϵÊôSQLServer¸ß¼¶±à³Ì£¬ÊÊÓÃÓÚÓûÌá¸ß×Ô¼ººÍ¸´Ï°»òÓ¦¸¶ÃæÊÔµÄÅóÓÑÔĶÁ£¬Í¬Ê±±¾ÈËѧϰ²»¾Ã£¬ÔÚ×ܽáºÍ¹éÄÉʱ´íÎóºÍ²»Ç¡µ±Ö®´¦ÔÚËùÄÑÃ⣬»¹ÇëÖ¸³öÆäÖБ¶ËÄß’£¬ÓèÒÔÍêÉÆ¡£
±í1:Users
USE [Wish]
GO
/****** ¶ÔÏó: Table [dbo].[Users] ½Å±¾ÈÕÆÚ: ......
select
convert(char(4),auth,120)+'Äê'+
substring(convert(char(10),auth,120),6,2)+'ÔÂ'+
substring(convert(char(10),auth,120),9,2)+'ÈÕ',
convert(char(4),appr,120)+'Äê'+
substring(convert(char(10),appr,120),6,2)+'ÔÂ'+
substring(convert(char(10),appr,120),9,2)+'ÈÕ'
from a
ÒÔÉÏ´úÂëʵÏֵĹ¦Ä ......
create proc P_QuerySplit
@sqlscript varchar(20), --±íÃû/SQLÓï¾ä
@pageSize int, --ÿҳ¼Ç¼Êý
@pageIndex int, &nbs ......
sqlserver2005Óйؼü×Öntile(x)ºÍover(partition by.. order by..)×Ó¾äÅäºÏ.
±ÈÈç»ñȡÿ¸ö±íµÄÇ°10%¸ö×ֶΡ£
select id , name , colid , rn from (
select * , rn = ntile (10 )
over (partition by id order by colorder )
from syscolumns )t where rn = 1 ......