Solved

Insert old user data into aspnet_Users & aspnet_Membership

Posted on 2011-03-02
1
1,290 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 500 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

752 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