--申明一个游标
DECLARE MyCursor CURSOR
FOR
select 经营主项编号,经营主项名称 from temp_dataMain order by 经营主项名称
--打开一个游标
OPEN MyCursor
--循环一个游标
DECLARE @BusinessCode nvarchar(50),
@BusinessName nvarchar(100)
FETCH NEXT FROM MyCursor INTO @BusinessCode, @BusinessName
WHILE @@FETCH_STATUS =0
BEGIN
--经营子项拼音吗
declare @inFPI nvarchar(500)
exec GSS_EMSDB_Function4GetFPI @BusinessName,@inFPI output
Insert into RSM_Business(
Id,
Name,
Code,
Tags,
IsDefault,
NameFPI,
AmountStyle,
VisibleToShops,
VisibleToNBS,
TaxPlus,
IsNeedMustCheck4Material,
IsNeedMustCheck4Assert,
Sys4CreateTime,
Sys4Version,
AreaCode)
values(
NEWID(),
@BusinessName,
@BusinessCode,
'',--Tags
0,
@inFPI,
'',
1,
0,
0,
0,
0,
GETDATE(),
10,
'101010'
)
FETCH NEXT FROM MyCursor INTO @BusinessCode, @BusinessName
END
--关闭游标
CLOSE MyCursor
--释放资源
DEALLOCATE MyCursor