Solved

error executing store procedure

Posted on 2006-11-10
1
1,569 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
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…

706 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

17 Experts available now in Live!

Get 1:1 Help Now