在这里,我只是重新阅读了 MS 文档,然后就去做了。这将设置一个用户帐户并为每条记录生成一个关键配置文件值。
declare @PPID NVARCHAR(20)
declare @salt NVARCHAR(500)
declare @stupid NVARCHAR(500)
declare @UserId uniqueidentifier
declare cur CURSOR LOCAL for
select PPID from webData..table where PPID is not null
open cur
fetch next from cur into @PPID
while @@FETCH_STATUS = 0 BEGIN
set @salt = @PPID + @PPID
set @stupid = 'TangiblePropertyId:S: 0:' + CONVERT(VARCHAR(10),LEN(@PPID))
--execute your sproc on each row
exec [aspnetdb].[dbo].[aspnet_Membership_CreateUser] '/',
@PPID
,@PPID
,@PPID
,@salt
,null
,null
,1
,'01/01/2011'
,DEFAULT
,DEFAULT
,DEFAULT
,@UserID
exec dbo.aspnet_UsersInRoles_AddUsersToRoles '/',@PPID,'TaxPayer','01/01/2011'
EXECUTE [aspnetdb].[dbo].[aspnet_Profile_SetProperties] '/' , @stupid ,@PPID ,'' ,@PPID ,false ,'01/01/2011'
PRINT @stupid
fetch next from cur into @PPID
END
close cur
deallocate cur