我现在用的存储过程是
CREATE procedure Pro_UploadData
as
set nocount on
declare @UploadTableName varchar(50),@UploadDataSource varchar(50),@OperationType varchar(20)
DECLARE upload_cursor CURSOR FOR select UploadTableName,UploadDataSource,OperationType from UpLoadData
OPEN upload_cursor
FETCH NEXT FROM upload_cursor
INTO @UploadTableName, @UploadDataSource,@OperationType
WHILE @@FETCH_STATUS = 0
begin
exec Pro_Insert2Table @UploadDataSource,@UploadTableName,@OperationType
FETCH NEXT FROM upload_cursor
INTO @UploadTableName, @UploadDataSource,@OperationType
end
CLOSE upload_cursor
DEALLOCATE upload_cursor
其中Pro_Insert2Table 为
CREATE procedure Pro_Insert2Table
(
@DataSource varchar(100),
@TableName varchar(100),
@OperationType varchar(20)
)
as
if(@DataSource<>'')
begin
declare @strInsert nvarchar(1000),@strUpdate varchar(8000),@userid varchar(50),@userPwd varchar(50)
select @userid=DBsUserName,@userPwd=dbo.xfun_Encrypt(DBsUserPassword,123456789) from DBServerInfo where DBsServerName=@DataSource
declare @strCreateView varchar(500)
set @strCreateView='alter view vw_u
as
'set @strCreateView=@strCreateView + 'select * from OpenDataSource(''SQLOLEDB'',''Data Source=' + @DataSource + ';User ID=' + @userid + ';Password=' + @userPwd + ''').fundjs.dbo.' + @TableName + '
go'
exec(@strCreateView)
select @strInsert='insert into vw_u select * from fundjs..' + @TableName + ' where Str_ScSign=0'
select @strUpdate= 'update fundjs..' + @TableName + ' set Str_ScSign=1 where Str_ScSign=0'
exec(@strInsert)
exec(@strUpdate)
if(@OperationType='update')
begin
select @strUpdate=' update vw_u set ' + dbo.fun_updateStr('vw_u',@TableName) + ' and t.Str_ScSign=2 '
exec(@strUpdate)
select @strUpdate= 'update fundjs..' + @TableName + ' set Str_ScSign=1 where Str_ScSign=2'
exec(@strUpdate)
end
end
可是老是超时或网络不通,现在要改成定是上传,我是再做一个还是在这个基础上改呢?