|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册账号
×
DECLARE @NAME varchar(50),@ZTH int,@ZTHM varchar(3),@ZTLJ varchar(100),@ZTLJ1 varchar(100),@ZTLJ2 varchar(100)
select @ZTH=0
WHILE @zth<999
BEGIN
select @ZTH=@zth+1,@zthM=@zth
if len(@ZTHM)<3
set @zthM=left('00',3-len(@ZTHM))+@zthM
select @ZTLJ='D:\ufdata\zt'+@ZTHM
EXEC sp_attach_db @dbname =@NAME,@filename1=@ZTLJ1,@filename2 = @ZTLJ2
select @name='ufdata_'+@zthm+'_2010',@ztlj1=@ztlj+'\2010\ufdata.mdf',@ztlj2=@ztlj+'\2010\ufdata.ldf'
EXEC sp_attach_db @dbname =@NAME,@filename1=@ZTLJ1,@filename2 = @ZTLJ2
select @name='ufdata_'+@zthm+'_2011',@ztlj1=@ztlj+'\2011\ufdata.mdf',@ztlj2=@ztlj+'\2011\ufdata.ldf'
EXEC sp_attach_db @dbname =@NAME,@filename1=@ZTLJ1,@filename2 = @ZTLJ2
select @name='ufdata_'+@zthm+'_2012',@ztlj1=@ztlj+'\2012\ufdata.mdf',@ztlj2=@ztlj+'\2012\ufdata.ldf'
EXEC sp_attach_db @dbname =@NAME,@filename1=@ZTLJ1,@filename2 = @ZTLJ2
select @name='ufdata_'+@zthm+'_2013',@ztlj1=@ztlj+'\2013\ufdata.mdf',@ztlj2=@ztlj+'\2013\ufdata.ldf'
EXEC sp_attach_db @dbname =@NAME,@filename1=@ZTLJ1,@filename2 = @ZTLJ2
IF @zth=183
BREAK
ELSE
CONTINUE
END
|
|