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

x
?
Solved

error executing store procedure

Posted on 2006-11-10
1
Medium Priority
?
1,592 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
[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 29

Accepted Solution

by:
Nightman earned 375 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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

715 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