-2
Declare @identifier nvarchar(100),
@identifier_New nvarchar(100)
Declare identifier cursor for
select distinct Identifier01
from update_rules
where Identifier01 is not null
and Vendor='Bloomberg'
and [Geneva Code]='Geneva77'
open identifier
fetch next from identifier into @identifier
while @@fetch_status=0
begin
set @identifier_New=upper(substring(@identifier,2,len(@identifier)-2))
if exists(select * from INFORMATION_SCHEMA.columns where table_name='investment' and [email protected]_New)
begin
update i set i.[BBG Final Identifier]=case when [email protected] then @identifier_New end
FROM investment i,update_rules u
where isnull(i.AType,'0')=isnull(u.[Asset Type],'0') and
isnull(i.IType,'0')=isnull(u.[Investment Type],'0') and
isnull(i.Under_AType,'0')=isnull(u.[Under Lying Asset Type],'0') and
isnull(i.Under_IType,'0')=isnull(u.[Under Lying Investment Type],'0') and
u.Vendor='Bloomberg' and u.[Geneva Code]='Geneva77'
end
fetch next from identifier into @identifier
end
close identifier
deallocate identifier
我得到一个错误,她SQL UPDATE查询逻辑
update i set i.[BBG Final Identifier]=case when [email protected]**identifier** then @identifier_New end
FROM investment i,update_rules u
这看起来像SQL服务器。你应该适当地标记问题。 – 2014-09-04 12:24:58
您能否请格式化您的代码,以便它可读并用实际的错误消息更新您的问题?我们无法帮助您解决一个模糊不清的问题。 – Josien 2014-09-04 12:25:12
什么是错误? – 2014-09-04 12:26:26