Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Insert old user data into aspnet_Users & aspnet_Membership

Posted on 2011-03-02
1
Medium Priority
?
1,317 Views
Last Modified: 2012-05-11
I'm trying to migrate user data from a previous database into the new aspnet membership schema. Specifically, I want to take user data from one table (UserName, Email) and add those records into the new schema, which means creating the records in the aspnet_Users table and the aspnet_Membership table. I could do it one record at a time through ASP.Net configuration, but I have 9000+ accounts I want to move over. What would be the best way to get this done? Any ideas?
0
Comment
Question by:dodgerfan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 7

Accepted Solution

by:
Cboudroz earned 2000 total points
ID: 35022792
if you have access to the both database on the same server you can create a cursor in T-SQL and do it in batch whit management studio.

I don't know the database schema, but you can create a cursor like this:


DECLARE @USERNAME VARCHAR(1000)
DECLARE @EMAIL VARCHAR(1000)

DECLARE cur_User CURSOR
FOR 
SELECT 
	USERNAME
	, EMAIL
FROM 
	OLDDATABASE..user  -- put the real database and table name here


OPEN cur_User 


FETCH NEXT FROM cur_User INTO @USERNAME, @EMAIL

WHILE @@FETCH_STATUS = 0
BEGIN 
	-- YOU NEED TO FOUND THE GOOD STORE PROCEDURE TO BE ABLE TO INSERT THE USER
	EXECUTE NEWDATABASE..USER_INS @USERNAME =  @USERNAME, @EMAIL = @EMAIL, @PASSWORD = 'TEST' 

	FETCH NEXT FROM cur_User INTO @USERNAME, @EMAIL
END

CLOSE cur_User
DEALLOCATE cur_User

Open in new window

0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question