Solved

error executing store procedure

Posted on 2006-11-10
1
1,575 Views
Last Modified: 2008-01-09
I need to insert all user name for table A into aspnet_membership table. I have to user stored procedure. this is what have so far but it complains about syntax at *** see below.  
--------------------------------------------------------------------
select  UserName into #tmpU from  Rams.dbo.tt_users
select * from #tmpU
 
Declare @cnt int
 
Set @cnt = 0

while @Cnt < (Select count(*) from #tmpU)
Begin
             

   EXEC       [dbo].[aspnet_membership_createuser]
 *** @UserName = #tmpU.UserName, @Password = 'mypassword' +  Convert(varchar(3000),@Cnt)),
      @PasswordSale = null,@Email = #tmpU.UserName,@PasswordQuestion='mypassword',
      @PasswordAnswer='mypassword',@IsApproved = 0,@CurrentTimeUtc=GetDate(), @CreateDate= null,@UniqueEmail=#tmpU.UserName,
      @PasswordFormat= null

End
----------------------------------------------------------------------
I cannot figure out what is the problem. I was passing values with setting @UserName etc but still have same issu.

appreciate it
-kushpaw
0
Comment
Question by:kushpaw
1 Comment
 
LVL 29

Accepted Solution

by:
Nightman earned 125 total points
ID: 17918277
If this is for MSSQL, try the following:


Declare @cnt int
Declare @username varchar(20)
Declare @MyPassword varchar(20)
Declare @Datestamp datetime
Set @cnt = 0
DECLARE tCursor CURSOR fast_forward
FOR
  SELECT
    UserName
  FROM
    Rams.dbo.tt_users
FOR READ ONLY
OPEN tCursor
FETCH next from tCursor into @username
WHILE @@FETCH_STATUS = 0
BEGIN
  set @cnt=@cnt+1
  set @MyPassword='mypassword' +  Convert(varchar(3000),@Cnt)
  set @Datestamp=getdate()
   EXEC      [dbo].[aspnet_membership_createuser]
      @UserName = @username,
      @Password = @MyPassword,
      @PasswordSale = null,
      @Email = @username,
      @PasswordQuestion='mypassword',
      @PasswordAnswer='mypassword',
      @IsApproved = 0,
      @CurrentTimeUtc = @Datestamp,
      @CreateDate = null,
      @UniqueEmail = @username,
      @PasswordFormat = null

FETCH NEXT FROM tCursor INTO @username
END
CLOSE tCursor
DEALLOCATE tCursor
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
The purpose of an index when the key is unique 10 93
What is ISQL? 6 123
Data center mess 4 71
Fixing Non-Standard characters in text 8 90
In today’s complex data management environments, it is not unusual for UNIX servers to be dedicated to a particular department, purpose, or database.  As a result, a SAS® data analyst often works with multiple servers, each with its own data storage…
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

932 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now